From 41ec7c32ace8ba89605e7923fe699de1998afbd6 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 16 Dec 2012 13:17:18 +0100 Subject: 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 --- .../corelib/tools/qregularexpression/tst_qregularexpression.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (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 3d61a847b0..8cb43a677d 100644 --- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp @@ -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() -- cgit v1.2.3