wxString::Trim() test.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39722 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -37,6 +37,7 @@ private:
 | 
			
		||||
        CPPUNIT_TEST( Format );
 | 
			
		||||
        CPPUNIT_TEST( Constructors );
 | 
			
		||||
        CPPUNIT_TEST( Extraction );
 | 
			
		||||
        CPPUNIT_TEST( Trim );
 | 
			
		||||
        CPPUNIT_TEST( Find );
 | 
			
		||||
        CPPUNIT_TEST( Replace );
 | 
			
		||||
        CPPUNIT_TEST( Match );
 | 
			
		||||
@@ -53,6 +54,7 @@ private:
 | 
			
		||||
    void Format();
 | 
			
		||||
    void Constructors();
 | 
			
		||||
    void Extraction();
 | 
			
		||||
    void Trim();
 | 
			
		||||
    void Find();
 | 
			
		||||
    void Replace();
 | 
			
		||||
    void Match();
 | 
			
		||||
@@ -198,6 +200,24 @@ void StringTestCase::Extraction()
 | 
			
		||||
    #undef TEST_ENDS_WITH
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void StringTestCase::Trim()
 | 
			
		||||
{
 | 
			
		||||
    #define TEST_TRIM( str , dir , result )  \
 | 
			
		||||
        CPPUNIT_ASSERT( wxString(str).Trim(dir) == result )
 | 
			
		||||
 | 
			
		||||
    TEST_TRIM( _T("  Test  "),  true, _T("  Test") );
 | 
			
		||||
    TEST_TRIM( _T("    "),      true, _T("")       );
 | 
			
		||||
    TEST_TRIM( _T(" "),         true, _T("")       );
 | 
			
		||||
    TEST_TRIM( _T(""),          true, _T("")       );
 | 
			
		||||
 | 
			
		||||
    TEST_TRIM( _T("  Test  "),  false, _T("Test  ") );
 | 
			
		||||
    TEST_TRIM( _T("    "),      false, _T("")       );
 | 
			
		||||
    TEST_TRIM( _T(" "),         false, _T("")       );
 | 
			
		||||
    TEST_TRIM( _T(""),          false, _T("")       );
 | 
			
		||||
 | 
			
		||||
    #undef TEST_TRIM
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void StringTestCase::Find()
 | 
			
		||||
{
 | 
			
		||||
    #define TEST_FIND( str , start , result )  \
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user