StringReplaceTest: Add (failing) invocations of Replace*() with NULL "to".
BeOS R5 treats NULL passed as the "replace with" argument as if it were an empty string. Our BString currently does nothing. Change-Id: I54b661e4ea8335ce531e6b6e3de2095a41112cd7 Reviewed-on: https://review.haiku-os.org/571 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
79187c3c42
commit
38a133eb8a
@@ -108,6 +108,12 @@ StringReplaceTest::PerformTest(void)
|
||||
"she sells sea shells on the seashore") == 0);
|
||||
delete str1;
|
||||
|
||||
NextSubTest();
|
||||
str1 = new BString("Error moving \"%name\"");
|
||||
str1->ReplaceFirst("%name", NULL);
|
||||
CPPUNIT_ASSERT(strcmp(str1->String(), "Error moving \"\"") == 0);
|
||||
delete str1;
|
||||
|
||||
// &ReplaceLast(const char*, const char*)
|
||||
NextSubTest();
|
||||
str1 = new BString("she sells sea shells on the seashore");
|
||||
@@ -123,6 +129,13 @@ StringReplaceTest::PerformTest(void)
|
||||
"she sells sea shells on the seashore") == 0);
|
||||
delete str1;
|
||||
|
||||
NextSubTest();
|
||||
str1 = new BString("she sells sea shells on the seashore");
|
||||
str1->ReplaceLast("sea", NULL);
|
||||
CPPUNIT_ASSERT(strcmp(str1->String(),
|
||||
"she sells sea shells on the shore") == 0);
|
||||
delete str1;
|
||||
|
||||
// &ReplaceAll(const char*, const char*, int32)
|
||||
NextSubTest();
|
||||
str1 = new BString("abc abc abc");
|
||||
@@ -136,6 +149,12 @@ StringReplaceTest::PerformTest(void)
|
||||
CPPUNIT_ASSERT(strcmp(str1->String(), "abc abc abc") == 0);
|
||||
delete str1;
|
||||
|
||||
NextSubTest();
|
||||
str1 = new BString("abc abc abc");
|
||||
str1->ReplaceAll("abc", NULL);
|
||||
CPPUNIT_ASSERT(strcmp(str1->String(), " ") == 0);
|
||||
delete str1;
|
||||
|
||||
NextSubTest();
|
||||
str1 = new BString("she sells sea shells on the seashore");
|
||||
str1->ReplaceAll("tex", "the");
|
||||
@@ -244,6 +263,13 @@ StringReplaceTest::PerformTest(void)
|
||||
"she sells sea shells on the seashore") == 0);
|
||||
delete str1;
|
||||
|
||||
NextSubTest();
|
||||
str1 = new BString("she sells SeA shells on the seashore");
|
||||
str1->IReplaceFirst("sea ", NULL);
|
||||
CPPUNIT_ASSERT(strcmp(str1->String(),
|
||||
"she sells shells on the seashore") == 0);
|
||||
delete str1;
|
||||
|
||||
// &IReplaceLast(const char*, const char*)
|
||||
#ifndef TEST_R5
|
||||
NextSubTest();
|
||||
@@ -260,6 +286,13 @@ StringReplaceTest::PerformTest(void)
|
||||
"she sells sea shells on the seashore") == 0);
|
||||
delete str1;
|
||||
|
||||
NextSubTest();
|
||||
str1 = new BString("she sells sea shells on the SEashore");
|
||||
str1->IReplaceLast("sea", NULL);
|
||||
CPPUNIT_ASSERT(strcmp(str1->String(),
|
||||
"she sells sea shells on the shore") == 0);
|
||||
delete str1;
|
||||
|
||||
// &IReplaceAll(const char*, const char*, int32)
|
||||
NextSubTest();
|
||||
str1 = new BString("abc ABc aBc");
|
||||
@@ -282,6 +315,13 @@ StringReplaceTest::PerformTest(void)
|
||||
"she sells SeA shells on the theshore") == 0);
|
||||
delete str1;
|
||||
|
||||
NextSubTest();
|
||||
str1 = new BString("abc ABc aBc");
|
||||
str1->IReplaceAll("ab", NULL);
|
||||
CPPUNIT_ASSERT(strcmp(str1->String(),
|
||||
"c c c") == 0);
|
||||
delete str1;
|
||||
|
||||
// ReplaceSet(const char*, char)
|
||||
NextSubTest();
|
||||
str1 = new BString("abc abc abc");
|
||||
|
||||
Reference in New Issue
Block a user