QString: add auto test for chop()
Change-Id: I8fc65c65776a64cc92e8cba3993d17746be81ba1 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>bb10
parent
b6c10cf331
commit
b36c6bab8d
|
|
@ -482,6 +482,7 @@ private slots:
|
|||
void sprintf();
|
||||
void fill();
|
||||
void truncate();
|
||||
void chop();
|
||||
void constructor();
|
||||
void constructorQByteArray_data();
|
||||
void constructorQByteArray();
|
||||
|
|
@ -1221,6 +1222,31 @@ void tst_QString::truncate()
|
|||
|
||||
}
|
||||
|
||||
void tst_QString::chop()
|
||||
{
|
||||
const QString original("abcd");
|
||||
|
||||
QString str = original;
|
||||
str.chop(1);
|
||||
QCOMPARE(str, QLatin1String("abc"));
|
||||
|
||||
str = original;
|
||||
str.chop(0);
|
||||
QCOMPARE(str, original);
|
||||
|
||||
str = original;
|
||||
str.chop(-1);
|
||||
QCOMPARE(str, original);
|
||||
|
||||
str = original;
|
||||
str.chop(original.size());
|
||||
QVERIFY(str.isEmpty());
|
||||
|
||||
str = original;
|
||||
str.chop(1000);
|
||||
QVERIFY(str.isEmpty());
|
||||
}
|
||||
|
||||
void tst_QString::fill()
|
||||
{
|
||||
QString e;
|
||||
|
|
|
|||
Loading…
Reference in New Issue