From 2f539d953b1d6dae0c8f2bb68fd6f8988a482073 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Tue, 29 Jul 2008 13:32:35 +0000 Subject: [PATCH] added a test for passing wxCharBufer to wxprintf functions git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54811 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/strings/vararg.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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); +} -- 2.45.2