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

Unified Diff: mojo/public/cpp/environment/tests/logging_unittest.cc

Issue 372163005: Fixes for re-enabling more MSVC level 4 warnings: mojo/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « no previous file | mojo/services/public/cpp/view_manager/lib/node.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/environment/tests/logging_unittest.cc
diff --git a/mojo/public/cpp/environment/tests/logging_unittest.cc b/mojo/public/cpp/environment/tests/logging_unittest.cc
index 2afad88aff26f0ca944220f21727e6eff642d868..643efe17e9402d4bf993213660c1ec8c0fd2e568 100644
--- a/mojo/public/cpp/environment/tests/logging_unittest.cc
+++ b/mojo/public/cpp/environment/tests/logging_unittest.cc
@@ -201,19 +201,6 @@ TEST_F(LoggingTest, LazyLogStream) {
MOJO_LAZY_LOG_STREAM(FATAL, false) << "hello";
EXPECT_FALSE(log_message_was_called());
-
- ResetMockLogger();
-
- bool x = false;
- // This probably fails to compile if we forget to parenthesize the condition
- // in the macro (= has low precedence, and needs an lvalue on the LHS).
- MOJO_LAZY_LOG_STREAM(ERROR, x = true) << "hello";
- EXPECT_TRUE(log_message_was_called());
-
- ResetMockLogger();
-
- MOJO_LAZY_LOG_STREAM(WARNING, x = false) << "hello";
- EXPECT_FALSE(log_message_was_called());
}
TEST_F(LoggingTest, ShouldLog) {
@@ -290,20 +277,6 @@ TEST_F(LoggingTest, LogIf) {
ResetMockLogger();
- bool x = false;
- // Also try to make sure that we parenthesize the condition properly.
- MOJO_LOG_IF(INFO, x = true) << "hello";
- EXPECT_TRUE(log_message_was_called());
- EXPECT_EQ(MOJO_LOG_LEVEL_INFO, last_log_level());
- EXPECT_EQ(ExpectedLogMessage(__LINE__-3, "hello"), last_message());
-
- ResetMockLogger();
-
- MOJO_LOG_IF(INFO, x = false) << "hello";
- EXPECT_FALSE(log_message_was_called());
-
- ResetMockLogger();
-
Environment::GetDefaultLogger()->SetMinimumLogLevel(MOJO_LOG_LEVEL_ERROR);
ResetMockLogger();
@@ -342,15 +315,13 @@ TEST_F(LoggingTest, Check) {
ResetMockLogger();
- bool x = true;
- // Also try to make sure that we parenthesize the condition properly.
viettrungluu 2014/07/08 15:19:28 Uhm, no. Way to defeat exactly what we're testing.
- MOJO_CHECK(x = false) << "hello";
+ MOJO_CHECK(false) << "hello";
EXPECT_TRUE(log_message_was_called());
EXPECT_EQ(MOJO_LOG_LEVEL_FATAL, last_log_level());
// Different compilers have different ideas about the line number of a split
// line.
int line = __LINE__;
- EXPECT_EQ(ExpectedLogMessage(line-5, "Check failed: x = false. hello"),
+ EXPECT_EQ(ExpectedLogMessage(line-5, "Check failed: false. hello"),
last_message());
ResetMockLogger();
@@ -430,7 +401,7 @@ TEST_F(LoggingTest, Dcheck) {
// non-debug builds. (Hopefully, we'll get an unused variable error if it
// fails to compile the condition.)
bool x = true;
- MOJO_DCHECK(x = false) << "hello";
+ MOJO_DCHECK(x == false) << "hello";
#ifdef NDEBUG
EXPECT_FALSE(log_message_was_called());
#else
@@ -439,7 +410,7 @@ TEST_F(LoggingTest, Dcheck) {
// Different compilers have different ideas about the line number of a split
// line.
int line = __LINE__;
- EXPECT_EQ(ExpectedLogMessage(line-8, "Check failed: x = false. hello"),
+ EXPECT_EQ(ExpectedLogMessage(line-8, "Check failed: x == false. hello"),
last_message());
#endif
}
« no previous file with comments | « no previous file | mojo/services/public/cpp/view_manager/lib/node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698