diff options
author | brucedawson <brucedawson@chromium.org> | 2015-11-04 17:05:42 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-05 01:06:21 +0000 |
commit | 4f5d484cfe4e2bb268dd479b6fbc23963aac564b (patch) | |
tree | 969cbc8a551b01fdd55debb135738472c85f371a /base/strings | |
parent | 13ce0f2bf5ad77c9fbb272bd9f3736cae4a80d0b (diff) | |
download | chromium_src-4f5d484cfe4e2bb268dd479b6fbc23963aac564b.zip chromium_src-4f5d484cfe4e2bb268dd479b6fbc23963aac564b.tar.gz chromium_src-4f5d484cfe4e2bb268dd479b6fbc23963aac564b.tar.bz2 |
Update StringPrintfTest.Invalid for VS 2015
VS 2015's vswprintf handles invalid unicode differently from VS 2013. The usage
of vswprintf through SStringPrintf and friends has been audited and this change
should not be a problem, so the test has been changed to let it pass instead of
blocking the compiler upgrade.
R=cpu@chromium.org
BUG=533002,440500
Review URL: https://codereview.chromium.org/1411683009
Cr-Commit-Position: refs/heads/master@{#357964}
Diffstat (limited to 'base/strings')
-rw-r--r-- | base/strings/stringprintf_unittest.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/base/strings/stringprintf_unittest.cc b/base/strings/stringprintf_unittest.cc index c49637c..e0b320f 100644 --- a/base/strings/stringprintf_unittest.cc +++ b/base/strings/stringprintf_unittest.cc @@ -148,10 +148,10 @@ 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. +// vswprintf in Visual Studio 2013 fails when given U+FFFF. This tests that the +// failure case is gracefuly handled. In Visual Studio 2015 the bad character +// is passed through. TEST(StringPrintfTest, Invalid) { wchar_t invalid[2]; invalid[0] = 0xffff; @@ -159,7 +159,11 @@ TEST(StringPrintfTest, Invalid) { std::wstring out; SStringPrintf(&out, L"%ls", invalid); +#if _MSC_VER >= 1900 + EXPECT_STREQ(invalid, out.c_str()); +#else EXPECT_STREQ(L"", out.c_str()); +#endif } #endif |