mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Fixed a bug in appending strings and added some relevant tests
This commit is contained in:
parent
70e58dcb21
commit
60590c0a1a
@ -635,7 +635,7 @@ String &String::operator+=(const wchar_t *s)
|
||||
{
|
||||
detach();
|
||||
|
||||
*d->data += *s;
|
||||
*d->data += s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -149,20 +149,30 @@ public:
|
||||
|
||||
void testAppendStringDetach()
|
||||
{
|
||||
String a("a");
|
||||
String a("abc");
|
||||
String b = a;
|
||||
a += "b";
|
||||
CPPUNIT_ASSERT_EQUAL(String("ab"), a);
|
||||
CPPUNIT_ASSERT_EQUAL(String("a"), b);
|
||||
String c = a;
|
||||
|
||||
b += "def";
|
||||
c += L"def";
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(String("abc"), a);
|
||||
CPPUNIT_ASSERT_EQUAL(String("abcdef"), b);
|
||||
CPPUNIT_ASSERT_EQUAL(String("abcdef"), c);
|
||||
}
|
||||
|
||||
void testAppendCharDetach()
|
||||
{
|
||||
String a("a");
|
||||
String a("abc");
|
||||
String b = a;
|
||||
a += 'b';
|
||||
CPPUNIT_ASSERT_EQUAL(String("ab"), a);
|
||||
CPPUNIT_ASSERT_EQUAL(String("a"), b);
|
||||
String c = a;
|
||||
|
||||
b += 'd';
|
||||
c += L'd';
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(String("abc"), a);
|
||||
CPPUNIT_ASSERT_EQUAL(String("abcd"), b);
|
||||
CPPUNIT_ASSERT_EQUAL(String("abcd"), c);
|
||||
}
|
||||
|
||||
void testRfind()
|
||||
|
Loading…
x
Reference in New Issue
Block a user