From a8a8a3bfbd4539e242360bc8a561390bbf9615f7 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Wed, 27 Aug 2014 12:34:42 +0200 Subject: [PATCH] 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 --- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index f8dab9fb088..7644c7523f0 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -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()