X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7978bc7293461eb09f4575e04ccf215b270e086e..f62edb0ecd881e790dd72b7f49da29e943200edb:/tests/strings/stdstrings.cpp diff --git a/tests/strings/stdstrings.cpp b/tests/strings/stdstrings.cpp index 3721bf9372..585d65c6e4 100644 --- a/tests/strings/stdstrings.cpp +++ b/tests/strings/stdstrings.cpp @@ -33,6 +33,7 @@ public: private: CPPUNIT_TEST_SUITE( StdStringTestCase ); CPPUNIT_TEST( StdConstructors ); + CPPUNIT_TEST( StdIterators ); CPPUNIT_TEST( StdAppend ); CPPUNIT_TEST( StdAssign ); CPPUNIT_TEST( StdCompare ); @@ -52,6 +53,7 @@ private: CPPUNIT_TEST_SUITE_END(); void StdConstructors(); + void StdIterators(); void StdAppend(); void StdAssign(); void StdCompare(); @@ -108,6 +110,15 @@ void StdStringTestCase::StdConstructors() WX_ASSERT_STR_EQUAL( "a", wxString(pw, pw + 1) ); } +void StdStringTestCase::StdIterators() +{ + // test compilation of default iterators ctors: + wxString::iterator i1; + wxString::const_iterator i2; + wxString::reverse_iterator i3; + wxString::const_reverse_iterator i4; +} + void StdStringTestCase::StdAppend() { wxString s1, s2, s3, s4, s5, s6, s7, s8; @@ -172,6 +183,9 @@ void StdStringTestCase::StdAssign() const wchar_t *pw = s1.c_str(); s8.assign(pw + 2, pw + 3); WX_ASSERT_STR_EQUAL( "f", s8 ); + + s1.assign(s1, 1, 1); + WX_ASSERT_STR_EQUAL("e", s1); } void StdStringTestCase::StdCompare() @@ -474,6 +488,11 @@ void StdStringTestCase::StdResize() CPPUNIT_ASSERT( s2 == _T("abcABCdefD") ); CPPUNIT_ASSERT( s3 == _T("abcABCdefDEF ") ); CPPUNIT_ASSERT( s4 == _T("abcABCdefDEFWW") ); + + wxString s = + wxString::FromUTF8("\xd0\x9f\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82"); + s.resize(3); + WX_ASSERT_STR_EQUAL("\xd0\x9f\xd1\x80\xd0\xb8", s); } void StdStringTestCase::StdRiter()