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>
This commit is contained in:
parent
4aec51e39f
commit
94495c814f
@ -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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user