Skip to content

Commit

Permalink
test: migrate QLibrary test to QRegularExpression
Browse files Browse the repository at this point in the history
This is part of the migration of qtbase from QRexExp to
QRegularExpression.

Task-number: QTBUG-72587
Change-Id: I60ffa6df83aaf520730cfbb1dd3f18a2d2e19977
Reviewed-by: Marc Mutz <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
sgaist committed Jun 10, 2019
1 parent c0f0e94 commit fd58792
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <QtTest/QtTest>
#include <qdir.h>
#include <qlibrary.h>
#include <QtCore/QRegExp>
#include <QtCore/QRegularExpression>


// Helper macros to let us know if some suffixes and prefixes are valid
Expand Down Expand Up @@ -414,10 +414,12 @@ void tst_QLibrary::errorString()
QFAIL(qPrintable(QString("Unknown operation: %1").arg(operation)));
break;
}
QRegExp re(errorString);
#if QT_CONFIG(regularexpression)
QRegularExpression re(QRegularExpression::anchoredPattern(errorString));
QString libErrorString = lib.errorString();
QVERIFY2(re.match(libErrorString).hasMatch(), qPrintable(libErrorString));
#endif
QVERIFY(!lib.isLoaded() || lib.unload());
QVERIFY2(re.exactMatch(libErrorString), qPrintable(libErrorString));
QCOMPARE(ok, success);
}

Expand Down

0 comments on commit fd58792

Please sign in to comment.