X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1de532f57e9a7d25158edb8aed633fb1099a04ea..a25a17732c2d4d34d5d35a5318053dd8c6e29722:/tests/strings/vararg.cpp?ds=sidebyside diff --git a/tests/strings/vararg.cpp b/tests/strings/vararg.cpp index b0e0eaa5da..1cc62ba3f0 100644 --- a/tests/strings/vararg.cpp +++ b/tests/strings/vararg.cpp @@ -41,6 +41,7 @@ private: CPPUNIT_TEST( StdString ); #endif CPPUNIT_TEST( Sscanf ); + CPPUNIT_TEST( RepeatedPrintf ); CPPUNIT_TEST_SUITE_END(); void StringPrintf(); @@ -49,6 +50,7 @@ private: void StdString(); #endif void Sscanf(); + void RepeatedPrintf(); DECLARE_NO_COPY_CLASS(VarArgTestCase) }; @@ -165,3 +167,19 @@ void VarArgTestCase::Sscanf() CPPUNIT_ASSERT( i == 42 ); CPPUNIT_ASSERT( wxStrcmp(wstr, "test") == 0 ); } + +void VarArgTestCase::RepeatedPrintf() +{ + wxCharBuffer buffer(2); + char *p = buffer.data(); + *p = 'h'; + p++; + *p = 'i'; + + wxString s; + s = wxString::Format("buffer %s, len %d", buffer, wxStrlen(buffer)); + CPPUNIT_ASSERT_EQUAL("buffer hi, len 2", s); + + s = wxString::Format("buffer %s, len %d", buffer, wxStrlen(buffer)); + CPPUNIT_ASSERT_EQUAL("buffer hi, len 2", s); +}