summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@idiap.ch>2019-06-10 09:12:09 +0200
committerSamuel Gaist <samuel.gaist@idiap.ch>2019-06-10 19:24:05 +0000
commit94495c814f4d83b3c1dd133b8d811265458de074 (patch)
tree0e3bfdc270b20a86a6c2e3b27809fd1f9854df9f /tests/auto/corelib/tools
parent4aec51e39f3ef68da14fbbfb278346b4839e9dc5 (diff)
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 <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r--tests/auto/corelib/tools/collections/tst_collections.cpp14
1 files changed, 9 insertions, 5 deletions
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()
{