From 94495c814f4d83b3c1dd133b8d811265458de074 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Mon, 10 Jun 2019 09:12:09 +0200 Subject: test: migrate collections test to QRegularExpression This is part of the migration of qtbase from QRexExp to QRegularExpression. Task-number: QTBUG-72587 Change-Id: Iff9d4be685bf360ad921e29a82cb878ae5c46180 Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/collections/tst_collections.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'tests/auto/corelib/tools/collections') diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index 734b018b39..b911be3ffb 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -76,7 +76,7 @@ void foo() #include "qlist.h" #include "qmap.h" #include "qpair.h" -#include "qregexp.h" +#include "qregularexpression.h" #include "qset.h" #include "qstack.h" #include "qstring.h" @@ -105,7 +105,9 @@ private slots: void map(); void bitArray(); void cache(); +#if QT_CONFIG(regularexpression) void regexp(); +#endif void pair(); void sharableQList(); void sharableQLinkedList(); @@ -2285,13 +2287,15 @@ void tst_Collections::cache() } +#if QT_CONFIG(regularexpression) void tst_Collections::regexp() { - QRegExp rx("^\\d\\d?$"); - QVERIFY(rx.indexIn("123") == -1); - QVERIFY(rx.indexIn("-6") == -1); - QVERIFY(rx.indexIn("6") == 0) ; + QRegularExpression rx("^\\d\\d?$"); + QVERIFY(!rx.match("123").hasMatch()); + QVERIFY(!rx.match("-6").hasMatch()); + QVERIFY(rx.match("6").hasMatch()) ; } +#endif void tst_Collections::pair() { -- cgit v1.2.3