Improve QRegularExpression autotests

Check that the regular expression, the match type and the match options
returned by QRegularExpression/QRegularExpressionIterator are the
same ones passed to match / globalMatch.

Change-Id: Ibd282379bb60b53d614b1d56a7e08b3d6c236da6
Reviewed-by: Jason McDonald <macadder1@gmail.com>
This commit is contained in:
Giuseppe D'Angelo 2012-12-16 13:17:18 +01:00 committed by The Qt Project
parent 59eb393cf5
commit 41ec7c32ac

View File

@ -697,6 +697,9 @@ void tst_QRegularExpression::normalMatch()
QRegularExpressionMatch m = regexp.match(subject, offset, QRegularExpression::NormalMatch, matchOptions);
consistencyCheck(m);
QVERIFY(m == match);
QCOMPARE(m.regularExpression(), regexp);
QCOMPARE(m.matchType(), QRegularExpression::NormalMatch);
QCOMPARE(m.matchOptions(), matchOptions);
}
@ -956,6 +959,9 @@ void tst_QRegularExpression::partialMatch()
QRegularExpressionMatch m = regexp.match(subject, offset, matchType, matchOptions);
consistencyCheck(m);
QVERIFY(m == match);
QCOMPARE(m.regularExpression(), regexp);
QCOMPARE(m.matchType(), matchType);
QCOMPARE(m.matchOptions(), matchOptions);
}
void tst_QRegularExpression::globalMatch_data()
@ -1228,6 +1234,9 @@ void tst_QRegularExpression::globalMatch()
QRegularExpressionMatchIterator iterator = regexp.globalMatch(subject, offset, matchType, matchOptions);
consistencyCheck(iterator);
QVERIFY(iterator == matchList);
QCOMPARE(iterator.regularExpression(), regexp);
QCOMPARE(iterator.matchType(), matchType);
QCOMPARE(iterator.matchOptions(), matchOptions);
}
void tst_QRegularExpression::serialize_data()