When you pass a negative number as Truncate() argument, the string is truncated to a length of 0 (before Truncate() just did nothing), because it makes more sense (there isn't any problem with R5 compatibility, because here R5's BString just crashed).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2403 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1ff1332c77
commit
5235e06864
@ -40,12 +40,12 @@ StringRemoveTest::PerformTest(void)
|
||||
#ifndef TEST_R5
|
||||
//new length is < 0
|
||||
//it crashes r5 implementation, but ours works fine here,
|
||||
//in this case, we ignore the truncation
|
||||
//in this case, we just truncate to 0
|
||||
NextSubTest();
|
||||
string1 = new BString("This is a long string");
|
||||
string1->Truncate(-3);
|
||||
CPPUNIT_ASSERT(strcmp(string1->String(), "This is a long string") == 0);
|
||||
CPPUNIT_ASSERT(string1->Length() == 21);
|
||||
CPPUNIT_ASSERT(strcmp(string1->String(), "") == 0);
|
||||
CPPUNIT_ASSERT(string1->Length() == 0);
|
||||
delete string1;
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user