]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/strings/vararg.cpp
Minor corrections to make dist after reports
[wxWidgets.git] / tests / strings / vararg.cpp
index b0e0eaa5da1fe368a0d53aabfc983c39d3b033a6..1cc62ba3f0dec6459d9d72544e838b1f09699d49 100644 (file)
@@ -41,6 +41,7 @@ private:
         CPPUNIT_TEST( StdString );
 #endif
         CPPUNIT_TEST( Sscanf );
         CPPUNIT_TEST( StdString );
 #endif
         CPPUNIT_TEST( Sscanf );
+        CPPUNIT_TEST( RepeatedPrintf );
     CPPUNIT_TEST_SUITE_END();
 
     void StringPrintf();
     CPPUNIT_TEST_SUITE_END();
 
     void StringPrintf();
@@ -49,6 +50,7 @@ private:
     void StdString();
 #endif
     void Sscanf();
     void StdString();
 #endif
     void Sscanf();
+    void RepeatedPrintf();
 
     DECLARE_NO_COPY_CLASS(VarArgTestCase)
 };
 
     DECLARE_NO_COPY_CLASS(VarArgTestCase)
 };
@@ -165,3 +167,19 @@ void VarArgTestCase::Sscanf()
     CPPUNIT_ASSERT( i == 42 );
     CPPUNIT_ASSERT( wxStrcmp(wstr, "test") == 0 );
 }
     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);
+}