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

Unified Diff: base/stringprintf_unittest.cc

Issue 9702002: Enable positional parameters for base::vsnprintf and base::vswprintf on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: NULL terminate the beginning of the buffer in case of a failure + a unit test. Created 8 years, 9 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 | « base/string_util_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/stringprintf_unittest.cc
diff --git a/base/stringprintf_unittest.cc b/base/stringprintf_unittest.cc
index ffb9c779ac027951579bfddaf2f0ab4cb1c0e1c9..1fc7f82e63d115cba619962bdfcffaaaa807060a 100644
--- a/base/stringprintf_unittest.cc
+++ b/base/stringprintf_unittest.cc
@@ -149,4 +149,17 @@ TEST(StringPrintfTest, Invalid) {
}
#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
« no previous file with comments | « base/string_util_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698