From c8f313b2565998ca68914a6dbeca4341964a37b7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 20 Aug 2007 10:38:22 +0000 Subject: [PATCH] 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 --- tests/strings/stdstrings.cpp | 3 +++ tests/strings/strings.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/tests/strings/stdstrings.cpp b/tests/strings/stdstrings.cpp index 7779de1d46..99355fe751 100644 --- a/tests/strings/stdstrings.cpp +++ b/tests/strings/stdstrings.cpp @@ -176,6 +176,9 @@ void StdStringTestCase::StdAssign() CPPUNIT_ASSERT( s5 == _T("aaa") ); CPPUNIT_ASSERT( s6 == _T("ef") ); + s1.assign(s1, 1, 1); + WX_ASSERT_STR_EQUAL("e", s1); + const char *pc = s1.c_str(); s7.assign(pc, pc + 2); WX_ASSERT_STR_EQUAL( "de", s7 ); diff --git a/tests/strings/strings.cpp b/tests/strings/strings.cpp index 6cbeba609f..473f81714f 100644 --- a/tests/strings/strings.cpp +++ b/tests/strings/strings.cpp @@ -214,6 +214,10 @@ void StringTestCase::Extraction() #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) \ CPPUNIT_ASSERT_EQUAL(result, s.EndsWith(suffix, &rest)); \ if ( result ) \ -- 2.45.2