summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2016-09-19 15:36:48 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2016-09-25 09:29:53 +0000
commit33d5e53f865d0950dc390afbe4ded442289c3090 (patch)
treebe2b88e32e01c9481d3b309483efba6322589dd3 /tests
parentb83922861ce7214eb5a2b192ab040c3cc8a42a96 (diff)
Replace Q_FOREACH/foreach with ranged-for
Change-Id: I7b4d13a49577a7d984727722ff2ae4458eab2d6e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/compiled/tst_compiled.cpp2
-rw-r--r--tests/auto/parser/tst_parser.cpp5
2 files changed, 4 insertions, 3 deletions
diff --git a/tests/auto/compiled/tst_compiled.cpp b/tests/auto/compiled/tst_compiled.cpp
index e09300e..27e4a80 100644
--- a/tests/auto/compiled/tst_compiled.cpp
+++ b/tests/auto/compiled/tst_compiled.cpp
@@ -79,7 +79,7 @@ void tst_Compiled::stateNames()
QCOMPARE(stateMachine.stateNames(false), ids1States);
- foreach (const QString &state, ids1States) {
+ for (const QString &state : qAsConst(ids1States)) {
QVariant prop = stateMachine.property(state.toUtf8().constData());
QVERIFY(!prop.isNull());
QVERIFY(prop.isValid());
diff --git a/tests/auto/parser/tst_parser.cpp b/tests/auto/parser/tst_parser.cpp
index 41927cf..0a0c287 100644
--- a/tests/auto/parser/tst_parser.cpp
+++ b/tests/auto/parser/tst_parser.cpp
@@ -49,7 +49,8 @@ void tst_Parser::error_data()
QTest::addColumn<QString>("errorFileName");
QDir dir(QLatin1String(":/tst_parser/data/"));
- foreach (const QString &entry, dir.entryList()) {
+ const auto dirEntries = dir.entryList();
+ for (const QString &entry : dirEntries) {
if (!entry.endsWith(QLatin1String(".errors"))) {
QString scxmlFileName = dir.filePath(entry);
QTest::newRow(entry.toLatin1().constData())
@@ -73,7 +74,7 @@ void tst_Parser::error()
const QVector<QScxmlError> errors = stateMachine->parseErrors();
if (errors.count() != expectedErrors.count()) {
- foreach (const QScxmlError &error, errors) {
+ for (const QScxmlError &error : errors) {
qDebug() << error.toString();
}
}