From 6b7898059386fe48d9de55d68f1f3f330ce8fb0a Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 23 Feb 2012 02:49:52 +0000 Subject: QRegularExpression: fix autotest Some minor fixes: obviously, a valid match always come from a valid regular expression, but a valid regular expression can create an invalid match (internal error during matching). Also, testing an invalid iterator should silence the emitted warnings. Change-Id: I585bb99a81e22f108601fd66bf30b56e0229d68b Reviewed-by: Thiago Macieira --- .../auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests/auto/corelib/tools/qregularexpression') diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp index 9430425532..238d8626c3 100644 --- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp @@ -191,9 +191,8 @@ bool operator!=(const QList &expectedMatchList, const QRegularExpressionM void consistencyCheck(const QRegularExpressionMatch &match) { - QVERIFY(match.isValid() == match.regularExpression().isValid()); - if (match.isValid()) { + QVERIFY(match.regularExpression().isValid()); QVERIFY(!(match.hasMatch() && match.hasPartialMatch())); if (match.hasMatch() || match.hasPartialMatch()) { @@ -260,7 +259,9 @@ void consistencyCheck(const QRegularExpressionMatchIterator &iterator) } } else { QVERIFY(!i.hasNext()); + QTest::ignoreMessage(QtWarningMsg, "QRegularExpressionMatchIterator::peekNext() called on an iterator already at end"); QRegularExpressionMatch peeked = i.peekNext(); + QTest::ignoreMessage(QtWarningMsg, "QRegularExpressionMatchIterator::next() called on an iterator already at end"); QRegularExpressionMatch match = i.next(); consistencyCheck(peeked); consistencyCheck(match); -- cgit v1.2.3