OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/string16.h" | 7 #include "base/string16.h" |
| 8 #include "base/utf_string_conversions.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
9 | 10 |
10 #if defined(WCHAR_T_IS_UTF32) | 11 #if defined(WCHAR_T_IS_UTF32) |
11 | 12 |
12 // We define a custom operator<< for string16 so we can use it with logging. | 13 // We define a custom operator<< for string16 so we can use it with logging. |
13 // This tests that conversion. | 14 // This tests that conversion. |
14 TEST(String16Test, OutputStream) { | 15 TEST(String16Test, OutputStream) { |
15 // Basic stream test. | 16 // Basic stream test. |
16 { | 17 { |
17 std::ostringstream stream; | 18 std::ostringstream stream; |
(...skipping 25 matching lines...) Expand all Loading... |
43 std::ostringstream stream; | 44 std::ostringstream stream; |
44 stream << initial_surrogate << "," << final_surrogate << "," | 45 stream << initial_surrogate << "," << final_surrogate << "," |
45 << surrogate_pair << ",", unterminated_surrogate; | 46 << surrogate_pair << ",", unterminated_surrogate; |
46 | 47 |
47 EXPECT_STREQ("\xef\xbf\xbd,\xef\xbf\xbd,\xf0\x90\x8c\x80z,\xef\xbf\xbds", | 48 EXPECT_STREQ("\xef\xbf\xbd,\xef\xbf\xbd,\xf0\x90\x8c\x80z,\xef\xbf\xbds", |
48 stream.str().c_str()); | 49 stream.str().c_str()); |
49 } | 50 } |
50 } | 51 } |
51 | 52 |
52 #endif | 53 #endif |
OLD | NEW |