diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-03-30 13:39:42 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-03-31 15:28:23 +0200 |
commit | 21a9b67cdbb3fdcc750523325bbdf2ae2834b6cd (patch) | |
tree | 3af6ab1dbc4d36ad8c2eb1e2a517147a8b5fa9bc /tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp | |
parent | 7f267360f2220322d9a4bec921be651f51f83da4 (diff) |
Port autotest away from QRegExp
Change-Id: I630fb93eca3f087f20d44a76058f7d6fe988ba5f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp')
-rw-r--r-- | tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp index f94756ed73..1807315061 100644 --- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp +++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp @@ -112,17 +112,18 @@ void tst_QSslKey::initTestCase() QDir dir(testDataDir + "keys"); const QFileInfoList fileInfoList = dir.entryInfoList(QDir::Files | QDir::Readable); - QRegExp rx(QLatin1String("^(rsa|dsa|dh|ec)-(pub|pri)-(\\d+)-?[\\w-]*\\.(pem|der)$")); + QRegularExpression rx(QLatin1String("^(rsa|dsa|dh|ec)-(pub|pri)-(\\d+)-?[\\w-]*\\.(pem|der)$")); for (const QFileInfo &fileInfo : fileInfoList) { - if (rx.indexIn(fileInfo.fileName()) >= 0) { + auto match = rx.match(fileInfo.fileName()); + if (match.hasMatch()) { keyInfoList << KeyInfo( fileInfo, - rx.cap(1) == QLatin1String("rsa") ? QSsl::Rsa : - rx.cap(1) == QLatin1String("dsa") ? QSsl::Dsa : - rx.cap(1) == QLatin1String("dh") ? QSsl::Dh : QSsl::Ec, - rx.cap(2) == QLatin1String("pub") ? QSsl::PublicKey : QSsl::PrivateKey, - rx.cap(3).toInt(), - rx.cap(4) == QLatin1String("pem") ? QSsl::Pem : QSsl::Der); + match.captured(1) == QLatin1String("rsa") ? QSsl::Rsa : + match.captured(1) == QLatin1String("dsa") ? QSsl::Dsa : + match.captured(1) == QLatin1String("dh") ? QSsl::Dh : QSsl::Ec, + match.captured(2) == QLatin1String("pub") ? QSsl::PublicKey : QSsl::PrivateKey, + match.captured(3).toInt(), + match.captured(4) == QLatin1String("pem") ? QSsl::Pem : QSsl::Der); } } } |