tst_QString: Use a non-empty string for lastIndexOfInvalidRegex
Testing using an empty string doesn't ensure that the regexp gets validated. The function may return earlier thus making the test useless. This patch adds a text to search in so that no early optimization avoids the regexp validation part Change-Id: If24b77385dde44a922d43e5ae1d7a5393d24f640 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
23a2ad6f61
commit
a8a8a3bfbd
@ -1418,7 +1418,7 @@ void tst_QString::lastIndexOf()
|
||||
void tst_QString::lastIndexOfInvalidRegex()
|
||||
{
|
||||
QTest::ignoreMessage(QtWarningMsg, "QString::lastIndexOf: invalid QRegularExpression object");
|
||||
QCOMPARE(QString("").lastIndexOf(QRegularExpression("invalid regex\\"), 0), -1);
|
||||
QCOMPARE(QString("invalid regex\\").lastIndexOf(QRegularExpression("invalid regex\\"), 0), -1);
|
||||
}
|
||||
|
||||
void tst_QString::count()
|
||||
|
Loading…
x
Reference in New Issue
Block a user