diff options
author | Samuel Gaist <samuel.gaist@idiap.ch> | 2019-06-10 16:49:19 +0200 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@idiap.ch> | 2019-06-10 16:49:19 +0200 |
commit | 16cc3ea585f26bc403e051f105df677a6da79dd5 (patch) | |
tree | ec27be213d578c9a2674a71469fb3e0bab220281 /tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | |
parent | 605dc42a0faceaaeb100cf538a0655614ed1a8fa (diff) |
test: migrate QNetworkReply test to QRegularExpression
This is part of the migration of qtbase from QRexExp to
QRegularExpression.
Task-number: QTBUG-72587
Change-Id: Ibdd3f63d9069c3f01dfe8431bcc64bde4f2aa569
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp')
-rw-r--r-- | tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index ca870f1cbb..8867e4dbaa 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -34,6 +34,8 @@ #include <QtCore/QEventLoop> #include <QtCore/QFile> #include <QtCore/QRandomGenerator> +#include <QtCore/QRegularExpression> +#include <QtCore/QRegularExpressionMatch> #include <QtCore/QSharedPointer> #include <QtCore/QScopedPointer> #include <QtCore/QTemporaryFile> @@ -7917,9 +7919,10 @@ void tst_QNetworkReply::synchronousAuthenticationCache() "Content-Type: text/plain\r\n" "\r\n" "auth"; - QRegExp rx("Authorization: Basic ([^\r\n]*)\r\n"); - if (rx.indexIn(receivedData) > 0) { - if (QByteArray::fromBase64(rx.cap(1).toLatin1()) == "login:password") { + QRegularExpression rx("Authorization: Basic ([^\r\n]*)\r\n"); + QRegularExpressionMatch match = rx.match(receivedData); + if (match.hasMatch()) { + if (QByteArray::fromBase64(match.captured(1).toLatin1()) == "login:password") { dataToTransmit = "HTTP/1.0 200 OK\r\n" "Content-Type: text/plain\r\n" |