added tests demonstrating a bug in wxString::assign(itself)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48214 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-08-20 10:38:22 +00:00
parent 6848478c72
commit c8f313b256
2 changed files with 7 additions and 0 deletions

View File

@@ -176,6 +176,9 @@ void StdStringTestCase::StdAssign()
CPPUNIT_ASSERT( s5 == _T("aaa") ); CPPUNIT_ASSERT( s5 == _T("aaa") );
CPPUNIT_ASSERT( s6 == _T("ef") ); CPPUNIT_ASSERT( s6 == _T("ef") );
s1.assign(s1, 1, 1);
WX_ASSERT_STR_EQUAL("e", s1);
const char *pc = s1.c_str(); const char *pc = s1.c_str();
s7.assign(pc, pc + 2); s7.assign(pc, pc + 2);
WX_ASSERT_STR_EQUAL( "de", s7 ); WX_ASSERT_STR_EQUAL( "de", s7 );

View File

@@ -214,6 +214,10 @@ void StringTestCase::Extraction()
#undef TEST_STARTS_WITH #undef TEST_STARTS_WITH
rest = "Hello world";
CPPUNIT_ASSERT( rest.StartsWith("Hello ", &rest) );
WX_ASSERT_STR_EQUAL("world", rest);
#define TEST_ENDS_WITH(suffix, correct_rest, result) \ #define TEST_ENDS_WITH(suffix, correct_rest, result) \
CPPUNIT_ASSERT_EQUAL(result, s.EndsWith(suffix, &rest)); \ CPPUNIT_ASSERT_EQUAL(result, s.EndsWith(suffix, &rest)); \
if ( result ) \ if ( result ) \