Index: base/logging_unittest.cc |
diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc |
index 22fb855b62afea792fb1708b5948f79d8a1f2848..354f6c7d6fcc339d24792a48e392d96af076e6c6 100644 |
--- a/base/logging_unittest.cc |
+++ b/base/logging_unittest.cc |
@@ -2,8 +2,11 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "base/compiler_specific.h" |
#include "base/logging.h" |
+ |
+#include <sstream> |
+ |
+#include "base/compiler_specific.h" |
#include "base/macros.h" |
#include "testing/gmock/include/gmock/gmock.h" |
@@ -276,6 +279,26 @@ TEST_F(LoggingTest, CheckEqStatements) { |
CHECK_EQ(false, true); // Unreached. |
} |
+// Test that scoped enums can be logged. |
+TEST_F(LoggingTest, ScopedEnum) { |
+#if 0 |
+ std::ostringstream ss1; |
+ // Default underlying type is int. |
+ enum class SignedTestEnum { |
+ Value = -1, |
+ }; |
+ ss1 << SignedTestEnum::Value; |
+ EXPECT_EQ("-1", ss1.str()); |
+ |
+ std::ostringstream ss2; |
+ enum class UnsignedTestEnum : unsigned { |
+ Value = -1, // This is intentional. |
+ }; |
+ ss2 << UnsignedTestEnum::Value; |
+ EXPECT_EQ("0xffffffff", ss2.str()); |
+#endif |
+} |
+ |
// Test that defining an operator<< for a type in a namespace doesn't prevent |
// other code in that namespace from calling the operator<<(ostream, wstring) |
// defined by logging.h. This can fail if operator<<(ostream, wstring) can't be |