diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2014-08-24 23:19:44 +0200 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@edeltech.ch> | 2014-08-26 00:36:59 +0200 |
commit | 76b4493595918370ef7b1f6922b1ae5e08b95a46 (patch) | |
tree | 68f32e78391f54a964376951aed2eac6bd664305 /tests/auto/corelib/tools/qstring | |
parent | 4cd53ad3a64dedc788346979fccabd8810104b20 (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')
-rw-r--r-- | tests/auto/corelib/tools/qstring/tst_qstring.cpp | 7 |
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" ); |