Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Unified Diff: webrtc/base/optional_unittest.cc

Issue 2426473004: Add rtc::Optional::reset (Closed)
Patch Set: ... Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/optional.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/optional_unittest.cc
diff --git a/webrtc/base/optional_unittest.cc b/webrtc/base/optional_unittest.cc
index b51701f6b26b6355f636919a2fc0dad8e5306fdf..056e9113df30c2d394ddfdb2a6bc0cf0b30f7e0a 100644
--- a/webrtc/base/optional_unittest.cc
+++ b/webrtc/base/optional_unittest.cc
@@ -369,6 +369,29 @@ TEST(OptionalTest, TestMoveAssignToFullFromT) {
*log);
}
+TEST(OptionalTest, TestResetEmpty) {
+ auto log = Logger::Setup();
+ {
+ Optional<Logger> x;
+ x.reset();
+ }
+ EXPECT_EQ(V(), *log);
+}
+
+TEST(OptionalTest, TestResetFull) {
+ auto log = Logger::Setup();
+ {
+ Optional<Logger> x(Logger(17));
+ log->push_back("---");
+ x.reset();
+ log->push_back("---");
+ }
+ EXPECT_EQ(
+ V("0:17. explicit constructor", "1:17. move constructor (from 0:17)",
+ "0:17. destructor", "---", "1:17. destructor", "---"),
+ *log);
+}
+
TEST(OptionalTest, TestDereference) {
auto log = Logger::Setup();
{
« no previous file with comments | « webrtc/base/optional.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698