Add test case for indexOf using an invalid QRegularExpression

Change-Id: I3677d0ecd406388a8f1eb65ec013595904da4c2d
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Samuel Gaist 2014-08-24 23:19:44 +02:00
parent 4cd53ad3a6
commit 76b4493595

View File

@ -163,6 +163,7 @@ private slots:
void lastIndexOfInvalidRegex();
void indexOf_data();
void indexOf();
void indexOfInvalidRegex();
void indexOf2_data();
void indexOf2();
void indexOf3_data();
@ -1298,6 +1299,12 @@ void tst_QString::indexOf2()
}
}
void tst_QString::indexOfInvalidRegex()
{
QTest::ignoreMessage(QtWarningMsg, "QString::indexOf: invalid QRegularExpression object");
QCOMPARE(QString("invalid regex\\").indexOf(QRegularExpression("invalid regex\\")), -1);
}
void tst_QString::lastIndexOf_data()
{
QTest::addColumn<QString>("haystack" );