diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-01-25 12:23:56 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-02-29 07:57:51 +0000 |
commit | be84480785b9686dc09937fa33b685de7cc570f1 (patch) | |
tree | ecfce6d5214095cc82d3c96df38cd07b4b7add18 /src/testlib/qtestcase.cpp | |
parent | a7885c9756d423042bd0670d82d78d8dffe9be54 (diff) |
QtTest: eradicate all Q_FOREACH loops
... by replacing them with C++11 ramge-for loops.
In one case, I took the liberty to remove a useless
if(isEmpty()) check around a for loop. Now that we
don't use Q_FOREACH anymore, we don't incur the copy
for empty containers anymore. Left the indention of
the loop level to avoid code churn.
Saves 1.8KiB in text size on optimized GCC 5.3 Linux
AMD64 builds.
Change-Id: I1b1fb34847f6a631f0d580fd5261c7f5fed8475c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r-- | src/testlib/qtestcase.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 4720c0564e..d5b4ae218f 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1694,8 +1694,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) handler.reset(new FatalSignalHandler); #endif TestMethods::MetaMethods commandLineMethods; - if (!QTest::testFunctions.isEmpty()) { - foreach (const QString &tf, QTest::testFunctions) { + for (const QString &tf : qAsConst(QTest::testFunctions)) { const QByteArray tfB = tf.toLatin1(); const QByteArray signature = tfB + QByteArrayLiteral("()"); QMetaMethod m = TestMethods::findMethod(testObject, signature.constData()); @@ -1706,7 +1705,6 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) exit(1); } commandLineMethods.push_back(m); - } } TestMethods test(testObject, commandLineMethods); test.invokeTests(testObject); |