diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 4 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxandroid.cpp | 3 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxbase.cpp | 3 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxjava.cpp | 3 | ||||
-rw-r--r-- | tests/auto/tools/tst_tools.cpp | 4 | ||||
-rw-r--r-- | tests/fuzzy-test/fuzzytester.cpp | 4 |
6 files changed, 9 insertions, 12 deletions
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 7351777e8..15440f838 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -2094,8 +2094,8 @@ void TestBlackbox::responseFiles() << "foo" << qbs::Internal::shellQuote(QStringLiteral("with space")).toUtf8() << "bar" << ""; QList<QByteArray> lines = file.readAll().split('\n'); - for (int i = 0; i < lines.size(); ++i) - lines[i] = lines.at(i).trimmed(); + for (auto &line : lines) + line = line.trimmed(); QCOMPARE(lines, expected); } diff --git a/tests/auto/blackbox/tst_blackboxandroid.cpp b/tests/auto/blackbox/tst_blackboxandroid.cpp index 8fba0d78e..a06dbbf8e 100644 --- a/tests/auto/blackbox/tst_blackboxandroid.cpp +++ b/tests/auto/blackbox/tst_blackboxandroid.cpp @@ -98,8 +98,7 @@ void TestBlackboxAndroid::android() "modules.Android.ndk.platform:android-21" }); params.profile = p.name(); QCOMPARE(runQbs(params), 0); - for (int i = 0; i < productNames.size(); ++i) { - const QString productName = productNames.at(i); + for (const QString &productName : qAsConst(productNames)) { QVERIFY(m_qbsStdout.contains(productName.toLocal8Bit() + ".apk")); const QString apkFilePath = relativeProductBuildDir(productName) + '/' + productName + ".apk"; diff --git a/tests/auto/blackbox/tst_blackboxbase.cpp b/tests/auto/blackbox/tst_blackboxbase.cpp index 6db5f66e0..cb36e13e1 100644 --- a/tests/auto/blackbox/tst_blackboxbase.cpp +++ b/tests/auto/blackbox/tst_blackboxbase.cpp @@ -152,8 +152,7 @@ QByteArray TestBlackboxBase::unifiedLineEndings(const QByteArray &ba) if (HostOsInfo::isWindowsHost()) { QByteArray result; result.reserve(ba.size()); - for (int i = 0; i < ba.size(); ++i) { - char c = ba.at(i); + for (const char &c : ba) { if (c != '\r') result.append(c); } diff --git a/tests/auto/blackbox/tst_blackboxjava.cpp b/tests/auto/blackbox/tst_blackboxjava.cpp index 3acb6bcef..6c76019db 100644 --- a/tests/auto/blackbox/tst_blackboxjava.cpp +++ b/tests/auto/blackbox/tst_blackboxjava.cpp @@ -78,8 +78,7 @@ void TestBlackboxJava::java() const QStringList classFiles = QStringList() << "Jet" << "Ship" << "Vehicles"; QStringList classFiles1 = QStringList(classFiles) << "io/qt/qbs/HelloWorld" << "NoPackage"; - for (int i = 0; i < classFiles1.size(); ++i) { - QString &classFile = classFiles1[i]; + for (QString &classFile : classFiles1) { classFile = relativeProductBuildDir("class_collection") + "/classes/" + classFile + ".class"; QVERIFY2(regularFileExists(classFile), qPrintable(classFile)); diff --git a/tests/auto/tools/tst_tools.cpp b/tests/auto/tools/tst_tools.cpp index 9707cb4ff..957f08885 100644 --- a/tests/auto/tools/tst_tools.cpp +++ b/tests/auto/tools/tst_tools.cpp @@ -427,8 +427,8 @@ void TestTools::testProcessNameByPid() int toNumber(const QString &str) { int res = 0; - for (int i = 0; i < str.length(); ++i) - res = (res * 10) + str[i].digitValue(); + for (const QChar &c : str) + res = (res * 10) + c.digitValue(); return res; } diff --git a/tests/fuzzy-test/fuzzytester.cpp b/tests/fuzzy-test/fuzzytester.cpp index 09a5f25f3..37a6c56fe 100644 --- a/tests/fuzzy-test/fuzzytester.cpp +++ b/tests/fuzzy-test/fuzzytester.cpp @@ -158,8 +158,8 @@ QString FuzzyTester::findWorkingStartCommit(const QString &startCommit) const QStringList allCommits = findAllCommits(startCommit); QString qbsError; m_currentActivity = buildFromScratchActivity(); - for (int i = allCommits.size() - 1; i >= 0; --i) { - m_currentCommit = allCommits.at(i); + for (auto it = allCommits.crbegin(), end = allCommits.crend(); it != end; ++it) { + m_currentCommit = *it; if (m_unbuildableCommits.contains(m_currentCommit)) { qDebug("Skipping known bad commit %s.", qPrintable(m_currentCommit)); continue; |