summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/badxml/tst_badxml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/testlib/selftests/badxml/tst_badxml.cpp')
-rw-r--r--tests/auto/testlib/selftests/badxml/tst_badxml.cpp31
1 files changed, 14 insertions, 17 deletions
diff --git a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp
index cb69905c34..a928a24d8a 100644
--- a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp
+++ b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp
@@ -1,6 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/QCoreApplication>
#include <QtCore/QStringList>
@@ -80,9 +79,9 @@ void tst_BadXml::badDataTag_data() const
{
QTest::addColumn<bool>("shouldFail");
- foreach (char const* str, badStrings()) {
- QTest::newRow(qPrintable(QString("fail %1").arg(str))) << true;
- QTest::newRow(qPrintable(QString("pass %1").arg(str))) << false;
+ for (const QByteArray &ba: badStrings()) {
+ QTest::addRow("fail %s", ba.constData()) << true;
+ QTest::addRow("pass %s", ba.constData()) << false;
}
}
@@ -123,9 +122,8 @@ void tst_BadXml::badMessage_data() const
QTest::addColumn<QByteArray>("message");
int i = 0;
- foreach (QByteArray const& str, badStrings()) {
+ for (const QByteArray &str : badStrings())
QTest::newRow(qPrintable(QString::fromLatin1("string %1").arg(i++))) << str;
- }
}
/*
@@ -133,13 +131,12 @@ void tst_BadXml::badMessage_data() const
*/
QList<QByteArray> const& tst_BadXml::badStrings()
{
- static QList<QByteArray> out;
- if (out.isEmpty()) {
- out << "end cdata ]]> text ]]> more text";
- out << "quotes \" text\" more text";
- out << "xml close > open < tags < text";
- out << "all > \" mixed ]]> up > \" in < the ]]> hopes < of triggering \"< ]]> bugs";
- }
+ static const QList<QByteArray> out = {
+ "end cdata ]]> text ]]> more text",
+ "quotes \" text\" more text",
+ "xml close > open < tags < text",
+ "all > \" mixed ]]> up > \" in < the ]]> hopes < of triggering \"< ]]> bugs",
+ };
return out;
}
@@ -180,16 +177,16 @@ int main(int argc, char** argv)
if (badstring == -1) {
tst_BadXml test;
- return QTest::qExec(&test, args.count(), const_cast<char**>(args.data()));
+ return QTest::qExec(&test, args.size(), const_cast<char**>(args.data()));
}
QList<QByteArray> badstrings = tst_BadXml::badStrings();
- if (badstring >= badstrings.count())
+ if (badstring >= badstrings.size())
qFatal("`-badstring %d' is out of range", badstring);
tst_BadXmlSub test;
test.className = badstrings[badstring].constData();
- return QTest::qExec(&test, args.count(), const_cast<char**>(args.data()));
+ return QTest::qExec(&test, args.size(), const_cast<char**>(args.data()));
}
#include "tst_badxml.moc"