summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorDavid Skoland <david.skoland@qt.io>2020-11-03 11:27:43 +0100
committerDavid Skoland <david.skoland@qt.io>2020-11-06 10:16:31 +0100
commit28f7c95e3b7fe56835f70c513b192eedf093d830 (patch)
tree305e81bd44b1d140dd655ec23c940c70f7b7aebf /tests/auto
parentdfec79f5d818e3cf1390e9c149501603c36d409b (diff)
Use built-in C++ foreach iteration in tests
Change-Id: I1e4bf9249ce26c034c676d78cfa16231226da05b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/thread/qfuture/tst_qfuture.cpp4
-rw-r--r--tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp10
2 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
index 18e11c35ad..93c97a68be 100644
--- a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
+++ b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
@@ -899,13 +899,13 @@ void tst_QFuture::multipleResults()
QList<int> fasit = QList<int>() << 1 << 2 << 3 << 4;
{
QList<int> results;
- foreach(int result, f)
+ for (int result : qAsConst(f))
results.append(result);
QCOMPARE(results, fasit);
}
{
QList<int> results;
- foreach(int result, copy)
+ for (int result : qAsConst(copy))
results.append(result);
QCOMPARE(results, fasit);
}
diff --git a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
index 10d7aa20f8..6b2df3cce4 100644
--- a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
+++ b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
@@ -518,7 +518,7 @@ void tst_QNetworkCookieJar::rfc6265_data()
QVERIFY(!document.isNull());
QVERIFY(document.isArray());
- foreach (const QJsonValue& testCase, document.array()) {
+ for (const QJsonValue testCase : document.array()) {
QJsonObject testObject = testCase.toObject();
//"test" - the test case name
@@ -527,15 +527,15 @@ void tst_QNetworkCookieJar::rfc6265_data()
continue;
//"received" - the cookies received from the server
- QJsonArray received = testObject.value("received").toArray();
+ const QJsonArray received = testObject.value("received").toArray();
QStringList receivedList;
- foreach (const QJsonValue& receivedCookie, received)
+ for (const QJsonValue receivedCookie : received)
receivedList.append(receivedCookie.toString());
//"sent" - the cookies sent back to the server
- QJsonArray sent = testObject.value("sent").toArray();
+ const QJsonArray sent = testObject.value("sent").toArray();
QList<QNetworkCookie> sentList;
- foreach (const QJsonValue& sentCookie, sent) {
+ for (const QJsonValue sentCookie : sent) {
QJsonObject sentCookieObject = sentCookie.toObject();
QNetworkCookie cookie;
cookie.setName(sentCookieObject.value("name").toString().toUtf8());