* fixed broken FindLast() taking a char and an offset
* added two more tests that exhibit the (now fixed) problem in FindLast() git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16586 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0d4c16e0c0
commit
94a055c10d
@ -1318,7 +1318,7 @@ BString::FindLast(char c, int32 beforeOffset) const
|
||||
return B_ERROR;
|
||||
|
||||
const char *start = String();
|
||||
const char *end = String() + Length() - beforeOffset;
|
||||
const char *end = String() + beforeOffset;
|
||||
|
||||
/* Scans the string backwards until we found the character, */
|
||||
/* or we reach the string's start */
|
||||
|
@ -249,6 +249,18 @@ StringSearchTest::PerformTest(void)
|
||||
CPPUNIT_ASSERT(i == B_ERROR);
|
||||
delete string1;
|
||||
|
||||
NextSubTest();
|
||||
string1 = new BString("abcd abcd");
|
||||
i = string1->FindLast('b', 6);
|
||||
CPPUNIT_ASSERT(i == 6);
|
||||
delete string1;
|
||||
|
||||
NextSubTest();
|
||||
string1 = new BString("abcd abcd");
|
||||
i = string1->FindLast('b', 5);
|
||||
CPPUNIT_ASSERT(i == 1);
|
||||
delete string1;
|
||||
|
||||
NextSubTest();
|
||||
string1 = new BString("abc abc abc");
|
||||
i = string1->FindLast("a", 0);
|
||||
|
Loading…
Reference in New Issue
Block a user