Index: base/stringprintf_unittest.cc |
diff --git a/base/stringprintf_unittest.cc b/base/stringprintf_unittest.cc |
index 6f4458b84498be8d217b0c71314f8a2264a10fa3..af2fe97bfbcf7b674ab7027ebb870e7921033113 100644 |
--- a/base/stringprintf_unittest.cc |
+++ b/base/stringprintf_unittest.cc |
@@ -28,37 +28,24 @@ TEST(StringPrintfTest, StringPrintfEmpty) { |
TEST(StringPrintfTest, StringPrintfMisc) { |
EXPECT_EQ("123hello w", StringPrintf("%3d%2s %1c", 123, "hello", 'w')); |
- EXPECT_EQ(L"123hello w", StringPrintf(L"%3d%2ls %1lc", 123, L"hello", 'w')); |
} |
TEST(StringPrintfTest, StringAppendfEmptyString) { |
std::string value("Hello"); |
StringAppendF(&value, "%s", ""); |
EXPECT_EQ("Hello", value); |
- |
- std::wstring valuew(L"Hello"); |
- StringAppendF(&valuew, L"%ls", L""); |
- EXPECT_EQ(L"Hello", valuew); |
} |
TEST(StringPrintfTest, StringAppendfString) { |
std::string value("Hello"); |
StringAppendF(&value, " %s", "World"); |
EXPECT_EQ("Hello World", value); |
- |
- std::wstring valuew(L"Hello"); |
- StringAppendF(&valuew, L" %ls", L"World"); |
- EXPECT_EQ(L"Hello World", valuew); |
} |
TEST(StringPrintfTest, StringAppendfInt) { |
std::string value("Hello"); |
StringAppendF(&value, " %d", 123); |
EXPECT_EQ("Hello 123", value); |
- |
- std::wstring valuew(L"Hello"); |
- StringAppendF(&valuew, L" %d", 123); |
- EXPECT_EQ(L"Hello 123", valuew); |
} |
// Make sure that lengths exactly around the initial buffer size are handled |
@@ -69,20 +56,11 @@ TEST(StringPrintfTest, StringPrintfBounds) { |
for (size_t i = 0; i < arraysize(src); i++) |
src[i] = 'A'; |
- wchar_t srcw[kSrcLen]; |
- for (size_t i = 0; i < arraysize(srcw); i++) |
- srcw[i] = 'A'; |
- |
for (int i = 1; i < 3; i++) { |
src[kSrcLen - i] = 0; |
std::string out; |
SStringPrintf(&out, "%s", src); |
EXPECT_STREQ(src, out.c_str()); |
- |
- srcw[kSrcLen - i] = 0; |
- std::wstring outw; |
- SStringPrintf(&outw, L"%ls", srcw); |
- EXPECT_STREQ(srcw, outw.c_str()); |
} |
} |
@@ -134,32 +112,11 @@ TEST(StringPrintfTest, GrowBoundary) { |
EXPECT_STREQ(src, out.c_str()); |
} |
-// TODO(evanm): what's the proper cross-platform test here? |
-#if defined(OS_WIN) |
-// sprintf in Visual Studio fails when given U+FFFF. This tests that the |
-// failure case is gracefuly handled. |
-TEST(StringPrintfTest, Invalid) { |
- wchar_t invalid[2]; |
- invalid[0] = 0xffff; |
- invalid[1] = 0; |
- |
- std::wstring out; |
- SStringPrintf(&out, L"%ls", invalid); |
- EXPECT_STREQ(L"", out.c_str()); |
-} |
-#endif |
- |
// Test that the positional parameters work. |
TEST(StringPrintfTest, PositionalParameters) { |
std::string out; |
SStringPrintf(&out, "%1$s %1$s", "test"); |
EXPECT_STREQ("test test", out.c_str()); |
- |
-#if defined(OS_WIN) |
- std::wstring wout; |
- SStringPrintf(&wout, L"%1$ls %1$ls", L"test"); |
- EXPECT_STREQ(L"test test", wout.c_str()); |
-#endif |
} |
} // namespace base |