+void VsnprintfTestCase::WrongFormatStrings()
+{
+ // test how wxVsnprintf() behaves with wrong format string:
+
+#if wxUSE_PRINTF_POS_PARAMS
+
+ // two positionals with the same index:
+ r = wxSnprintf(buf, MAX_TEST_LEN, wxT("%1$s %1$s"), "hello");
+ CPPUNIT_ASSERT(r == -1);
+
+ // three positionals with the same index mixed with other pos args:
+ r = wxSnprintf(buf, MAX_TEST_LEN, wxT("%4$d %2$f %1$s %2$s %3$d"), "hello", "world", 3, 4);
+ CPPUNIT_ASSERT(r == -1);
+
+ // a missing positional arg:
+ r = wxSnprintf(buf, MAX_TEST_LEN, wxT("%1$d %3$d"), 1, 2, 3);
+ CPPUNIT_ASSERT(r == -1);
+
+ // positional and non-positionals in the same format string:
+ r = wxSnprintf(buf, MAX_TEST_LEN, wxT("%1$d %d %3$d"), 1, 2, 3);
+ CPPUNIT_ASSERT(r == -1);
+
+#endif // wxUSE_PRINTF_POS_PARAMS
+}
+