summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstring/tst_qstring.cpp
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@edeltech.ch>2014-08-24 23:19:44 +0200
committerSamuel Gaist <samuel.gaist@edeltech.ch>2014-08-26 00:36:59 +0200
commit76b4493595918370ef7b1f6922b1ae5e08b95a46 (patch)
tree68f32e78391f54a964376951aed2eac6bd664305 /tests/auto/corelib/tools/qstring/tst_qstring.cpp
parent4cd53ad3a64dedc788346979fccabd8810104b20 (diff)
Add test case for indexOf using an invalid QRegularExpression
Change-Id: I3677d0ecd406388a8f1eb65ec013595904da4c2d Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'tests/auto/corelib/tools/qstring/tst_qstring.cpp')
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 255fbddb9c..f8dab9fb08 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -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" );