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 <thiago.macieira@intel.com>
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()) {
}
} 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);