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

Unified Diff: base/logging_unittest.cc

Issue 2001783002: base: Support using (D)CHECK on scoped enums. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use CR_GLIBCXX_4_7_0 macro, since I bothered to define it Created 4 years, 7 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
« base/logging.h ('K') | « base/logging.cc ('k') | base/template_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/logging_unittest.cc
diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc
index 7254265b177f5e7df4db8af969c133e7c2645424..8a20c54fb4c605734bf45c4b8bb582a76276e104 100644
--- a/base/logging_unittest.cc
+++ b/base/logging_unittest.cc
@@ -251,6 +251,13 @@ TEST_F(LoggingTest, Dcheck) {
DCHECK_NE(p_not_null, nullptr);
DCHECK_NE(nullptr, p_not_null);
EXPECT_EQ(0, log_sink_call_count);
+
+ // Test DCHECK on a scoped enum.
+ enum class Animal { DOG, CAT };
+ DCHECK_EQ(Animal::DOG, Animal::DOG);
+ EXPECT_EQ(0, log_sink_call_count);
+ DCHECK_EQ(Animal::DOG, Animal::CAT);
+ EXPECT_EQ(DCHECK_IS_ON() ? 1 : 0, log_sink_call_count);
}
TEST_F(LoggingTest, DcheckReleaseBehavior) {
« base/logging.h ('K') | « base/logging.cc ('k') | base/template_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698