From b2fb26baeada7b39331f71a30c654bfb8b53cb30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Tue, 11 Oct 2022 10:23:36 +0200 Subject: [PATCH] qt,tests: Port test to QRegularExpression. * lang/qt/tests/t-trustsignatures.cpp: Use QRegularExpression instead of QRegExp. -- This allows building with Qt 6 without Core5Compat. --- lang/qt/tests/t-trustsignatures.cpp | 33 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/lang/qt/tests/t-trustsignatures.cpp b/lang/qt/tests/t-trustsignatures.cpp index 6f7ad827..2626096a 100644 --- a/lang/qt/tests/t-trustsignatures.cpp +++ b/lang/qt/tests/t-trustsignatures.cpp @@ -41,6 +41,7 @@ #include "protocol.h" #include "signkeyjob.h" +#include #include #include #include @@ -113,9 +114,9 @@ private Q_SLOTS: QVERIFY(trustSignature.trustScope()); const auto trustScope = QString::fromUtf8(trustSignature.trustScope()); QVERIFY(!trustScope.isEmpty()); - const QRegExp regex{trustScope}; + const QRegularExpression regex{trustScope}; QVERIFY(regex.isValid()); - QVERIFY(regex.indexIn(QStringLiteral("Foo ")) != -1); + QVERIFY(regex.match(QStringLiteral("Foo ")).hasMatch()); } // Create second trust signature @@ -158,9 +159,9 @@ private Q_SLOTS: QVERIFY(trustSignature.trustScope()); const auto trustScope = QString::fromUtf8(trustSignature.trustScope()); QVERIFY(!trustScope.isEmpty()); - const QRegExp regex{trustScope}; + const QRegularExpression regex{trustScope}; QVERIFY(regex.isValid()); - QVERIFY(regex.indexIn(QStringLiteral("Foo ")) != -1); + QVERIFY(regex.match(QStringLiteral("Foo ")).hasMatch()); } } @@ -224,9 +225,9 @@ private Q_SLOTS: QVERIFY(trustSignature.trustScope()); const auto trustScope = QString::fromUtf8(trustSignature.trustScope()); QVERIFY(!trustScope.isEmpty()); - const QRegExp regex{trustScope}; + const QRegularExpression regex{trustScope}; QVERIFY(regex.isValid()); - QVERIFY(regex.indexIn(QStringLiteral("Foo ")) != -1); + QVERIFY(regex.match(QStringLiteral("Foo ")).hasMatch()); } // Create second trust signature @@ -269,9 +270,9 @@ private Q_SLOTS: QVERIFY(trustSignature.trustScope()); const auto trustScope = QString::fromUtf8(trustSignature.trustScope()); QVERIFY(!trustScope.isEmpty()); - const QRegExp regex{trustScope}; + const QRegularExpression regex{trustScope}; QVERIFY(regex.isValid()); - QVERIFY(regex.indexIn(QStringLiteral("Foo ")) != -1); + QVERIFY(regex.match(QStringLiteral("Foo ")).hasMatch()); } } @@ -336,9 +337,9 @@ private Q_SLOTS: QVERIFY(trustSignature.trustScope()); const auto trustScope = QString::fromUtf8(trustSignature.trustScope()); QVERIFY(!trustScope.isEmpty()); - const QRegExp regex{trustScope}; + const QRegularExpression regex{trustScope}; QVERIFY(regex.isValid()); - QVERIFY(regex.indexIn(QStringLiteral("Foo ")) != -1); + QVERIFY(regex.match(QStringLiteral("Foo ")).hasMatch()); } // Create second trust signature @@ -381,9 +382,9 @@ private Q_SLOTS: QVERIFY(trustSignature.trustScope()); const auto trustScope = QString::fromUtf8(trustSignature.trustScope()); QVERIFY(!trustScope.isEmpty()); - const QRegExp regex{trustScope}; + const QRegularExpression regex{trustScope}; QVERIFY(regex.isValid()); - QVERIFY(regex.indexIn(QStringLiteral("Foo ")) != -1); + QVERIFY(regex.match(QStringLiteral("Foo ")).hasMatch()); } } @@ -447,9 +448,9 @@ private Q_SLOTS: QVERIFY(trustSignature.trustScope()); const auto trustScope = QString::fromUtf8(trustSignature.trustScope()); QVERIFY(!trustScope.isEmpty()); - const QRegExp regex{trustScope}; + const QRegularExpression regex{trustScope}; QVERIFY(regex.isValid()); - QVERIFY(regex.indexIn(QStringLiteral("Foo ")) != -1); + QVERIFY(regex.match(QStringLiteral("Foo ")).hasMatch()); } // Create second trust signature @@ -493,9 +494,9 @@ private Q_SLOTS: QVERIFY(trustSignature.trustScope()); const auto trustScope = QString::fromUtf8(trustSignature.trustScope()); QVERIFY(!trustScope.isEmpty()); - const QRegExp regex{trustScope}; + const QRegularExpression regex{trustScope}; QVERIFY(regex.isValid()); - QVERIFY(regex.indexIn(QStringLiteral("Foo ")) != -1); + QVERIFY(regex.match(QStringLiteral("Foo ")).hasMatch()); } }