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

Side by Side Diff: base/logging_unittest.cc

Issue 650393002: Modify ALLOW_UNUSED to allow enabling unused local warnings on MSVC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert review comment Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 7
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 DCHECK_EQ(some_variable, 1) << "test"; 233 DCHECK_EQ(some_variable, 1) << "test";
234 } 234 }
235 235
236 // Test that defining an operator<< for a type in a namespace doesn't prevent 236 // Test that defining an operator<< for a type in a namespace doesn't prevent
237 // other code in that namespace from calling the operator<<(ostream, wstring) 237 // other code in that namespace from calling the operator<<(ostream, wstring)
238 // defined by logging.h. This can fail if operator<<(ostream, wstring) can't be 238 // defined by logging.h. This can fail if operator<<(ostream, wstring) can't be
239 // found by ADL, since defining another operator<< prevents name lookup from 239 // found by ADL, since defining another operator<< prevents name lookup from
240 // looking in the global namespace. 240 // looking in the global namespace.
241 namespace nested_test { 241 namespace nested_test {
242 class Streamable {}; 242 class Streamable {};
243 ALLOW_UNUSED std::ostream& operator<<(std::ostream& out, const Streamable&) { 243 ALLOW_UNUSED_TYPE std::ostream& operator<<(std::ostream& out,
244 const Streamable&) {
244 return out << "Streamable"; 245 return out << "Streamable";
245 } 246 }
246 TEST_F(LoggingTest, StreamingWstringFindsCorrectOperator) { 247 TEST_F(LoggingTest, StreamingWstringFindsCorrectOperator) {
247 std::wstring wstr = L"Hello World"; 248 std::wstring wstr = L"Hello World";
248 std::ostringstream ostr; 249 std::ostringstream ostr;
249 ostr << wstr; 250 ostr << wstr;
250 EXPECT_EQ("Hello World", ostr.str()); 251 EXPECT_EQ("Hello World", ostr.str());
251 } 252 }
252 } // namespace nested_test 253 } // namespace nested_test
253 254
254 } // namespace 255 } // namespace
255 256
256 } // namespace logging 257 } // namespace logging
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698