diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2019-07-01 20:05:36 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2022-02-22 21:15:31 +0100 |
commit | 8123a69e6edcd7080652489e8e758406a7a0e378 (patch) | |
tree | 1b24d7336a919e621c108d6d42fdd2b108f62865 /tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp | |
parent | b727f2190fb4878aad5edf1536e875e1b75907ae (diff) |
QRegularExpression: print the pattern when warning
Just as a minor debugging helper: when warning that an invalid
regular expression object is being used to match, also print
the used regular expression pattern.
Change-Id: I0f99bcf4ca87ec67d04ed91d9dc315814f56d392
Fixes: QTBUG-76670
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp')
-rw-r--r-- | tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp index 9ded894472..08c787576d 100644 --- a/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp @@ -712,18 +712,23 @@ void tst_QRegularExpression::validity_data() void tst_QRegularExpression::validity() { + static const QRegularExpression ignoreMessagePattern( + "^" + QRegularExpression::escape("QRegularExpressionPrivate::doMatch(): " + "called on an invalid QRegularExpression object") + ); + QFETCH(QString, pattern); QFETCH(bool, validity); QRegularExpression re(pattern); QCOMPARE(re.isValid(), validity); if (!validity) - QTest::ignoreMessage(QtWarningMsg, "QRegularExpressionPrivate::doMatch(): called on an invalid QRegularExpression object"); + QTest::ignoreMessage(QtWarningMsg, ignoreMessagePattern); QRegularExpressionMatch match = re.match("a pattern"); QCOMPARE(match.isValid(), validity); consistencyCheck(match); if (!validity) - QTest::ignoreMessage(QtWarningMsg, "QRegularExpressionPrivate::doMatch(): called on an invalid QRegularExpression object"); + QTest::ignoreMessage(QtWarningMsg, ignoreMessagePattern); QRegularExpressionMatchIterator iterator = re.globalMatch("a pattern"); QCOMPARE(iterator.isValid(), validity); } |