diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-02-09 14:29:21 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-03-20 08:19:25 +0000 |
commit | 5a4787dca01c302dd462a76222dfbf28c8951a8d (patch) | |
tree | 897b7caea659526d740e98c06b11c15970d35a7b /src/testlib/qtestlog.cpp | |
parent | dd74f5d347d0a5a21527142f85114374e2d90646 (diff) |
Modernize the "regularexpression" feature
Use QT_CONFIG(regularexpression), disentangle it from QT_BOOTSTRAPPED,
switch it off in the bootstrap build, remove the #ifdefs from
qregularexpression.{h|cpp}, and add QT_REQUIRE_CONFIG(regularexpression)
to the header.
qregularexpression.{h|cpp} are already correctly excluded in tools.pri
if !qtConfig(regularexpression).
Change-Id: I21de154a6a118b76f99003d3acb72ac1e220d302
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/testlib/qtestlog.cpp')
-rw-r--r-- | src/testlib/qtestlog.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 4964c6538e..6260b9e3fd 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -55,7 +55,9 @@ #include <QtCore/qbytearray.h> #include <QtCore/QElapsedTimer> #include <QtCore/QVariant> +#if QT_CONFIG(regularexpression) #include <QtCore/QRegularExpression> +#endif #include <stdlib.h> #include <string.h> @@ -139,7 +141,7 @@ namespace QTest { return tp == type && (pattern.type() == QVariant::String ? stringsMatch(pattern.toString(), message) : -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) pattern.toRegularExpression().match(message).hasMatch()); #else false); @@ -364,7 +366,7 @@ void QTestLog::printUnhandledIgnoreMessages() if (list->pattern.type() == QVariant::String) { message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"'); } else { -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"'); #endif } @@ -548,14 +550,14 @@ void QTestLog::ignoreMessage(QtMsgType type, const char *msg) QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QString::fromLocal8Bit(msg)); } -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expression) { QTEST_ASSERT(expression.isValid()); QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QVariant(expression)); } -#endif // QT_NO_REGULAREXPRESSION +#endif // QT_CONFIG(regularexpression) void QTestLog::setMaxWarnings(int m) { |