]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/strings/strings.cpp
Documentation patch from Olly Betts
[wxWidgets.git] / tests / strings / strings.cpp
index 242372e9a6cf2c50a5da8c24ea41f690eb9ff5d9..1aa6be1ba8a06fe3aa61ef9e547d7f9964fdae43 100644 (file)
@@ -155,12 +155,14 @@ void StringTestCase::Constructors()
 #if wxUSE_WCHAR_T
 void StringTestCase::ConstructorsWithConversion()
 {
-    // Déj`a in UTF-8 and wchar_t:
-    const unsigned char utf8[] = {0x44,0xC3,0xA9,0x6A,0xC3,0xA0,0};
+    // the string "Déjà" in UTF-8 and wchar_t:
+    const unsigned char utf8Buf[] = {0x44,0xC3,0xA9,0x6A,0xC3,0xA0,0};
     const wchar_t wchar[] = {0x44,0xE9,0x6A,0xE0,0};
-    const unsigned char utf8sub[] = {0x44,0xC3,0xA9,0x6A,0}; // "Dej"
+    const unsigned char utf8subBuf[] = {0x44,0xC3,0xA9,0x6A,0}; // just "Déj"
+    const char *utf8 = (char *)utf8Buf;
+    const char *utf8sub = (char *)utf8subBuf;
 
-    wxString s1((char *)utf8, wxConvUTF8);
+    wxString s1(utf8, wxConvUTF8);
     wxString s2(wchar, wxConvUTF8);
 
 #if wxUSE_UNICODE
@@ -171,8 +173,8 @@ void StringTestCase::ConstructorsWithConversion()
     CPPUNIT_ASSERT( s2 == utf8 );
 #endif
 
-    wxString sub((char *)utf8sub, wxConvUTF8); // "Dej" substring
-    wxString s3((char *)utf8, wxConvUTF8, 4);
+    wxString sub(utf8sub, wxConvUTF8); // "Dej" substring
+    wxString s3(utf8, wxConvUTF8, 4);
     wxString s4(wchar, wxConvUTF8, 3);
 
     CPPUNIT_ASSERT( s3 == sub );
@@ -338,8 +340,8 @@ DoTokenizerGetPosition(const wxChar *s, const wxChar *delims, int pos, ...)
 void StringTestCase::TokenizerGetPosition()
 {
     DoTokenizerGetPosition(_T("foo"), _T("_"), 3, 0);
-    DoTokenizerGetPosition(_T("foo_bar"), _T("_"), 3, 7, 0);
-    DoTokenizerGetPosition(_T("foo_bar_"), _T("_"), 3, 7,8,  0);
+    DoTokenizerGetPosition(_T("foo_bar"), _T("_"), 4, 7, 0);
+    DoTokenizerGetPosition(_T("foo_bar_"), _T("_"), 4, 8, 0);
 }
 
 void StringTestCase::Replace()