diff --git a/tests/strings/strings.cpp b/tests/strings/strings.cpp index f31c57988e..49cbd8d4af 100644 --- a/tests/strings/strings.cpp +++ b/tests/strings/strings.cpp @@ -168,11 +168,24 @@ void StringTestCase::Format() } + // Positional parameters tests: CPPUNIT_ASSERT_EQUAL ( "two one", wxString::Format(wxT("%2$s %1$s"), wxT("one"), wxT("two")) ); + + CPPUNIT_ASSERT_EQUAL + ( + "hello hello", + wxString::Format("%1$s %1$s", "hello") + ); + + CPPUNIT_ASSERT_EQUAL + ( + "4 world hello world 3", + wxString::Format("%4$d %2$s %1$s %2$s %3$d", "hello", "world", 3, 4) + ); } void StringTestCase::FormatUnicode() diff --git a/tests/strings/vsnprintf.cpp b/tests/strings/vsnprintf.cpp index 4018229cea..14d2144272 100644 --- a/tests/strings/vsnprintf.cpp +++ b/tests/strings/vsnprintf.cpp @@ -435,19 +435,6 @@ void VsnprintfTestCase::WrongFormatStrings() { // test how wxVsnprintf() behaves with wrong format string: -#if 0 - // NB: the next 2 tests currently return an error but it would be nice - // if they didn't (see ticket #9367) - - // 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); -#endif - // a missing positional arg should result in an assert WX_ASSERT_FAILS_WITH_ASSERT( wxSnprintf(buf, MAX_TEST_LEN, wxT("%1$d %3$d"), 1, 2, 3) );