diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-05-24 11:43:29 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-11 09:16:31 +0200 |
commit | 6fbf50248db858cf47dddd8b917685f757b83a97 (patch) | |
tree | 2b0a802423438576c24714afc4c65e06ca3c35f9 | |
parent | 45373c19243aea335897ba0f371a1dd53ae8f079 (diff) |
Brush up tst_QUrl
Fix clang-tidy warnings:
- Use range-based for and streamline some code
- Use nullptr
Change-Id: Iad43490d0e968baa76d54d3bf81558a48b19cdbd
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
-rw-r--r-- | tests/auto/corelib/io/qurl/tst_qurl.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index daaa5516cd..3123c42326 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -2192,10 +2192,12 @@ void tst_QUrl::schemeValidator_data() QTest::newRow("percent-encoded") << "%68%74%%74%70://example.com" << false << "%68%74%%74%70"; static const char controls[] = "!\"$&'()*,;<=>[\\]^_`{|}~"; - for (size_t i = 0; i < sizeof(controls) - 1; ++i) - QTest::newRow(("with-" + QByteArray(1, controls[i])).constData()) - << QString("pre%1post://example.com/").arg(QLatin1Char(controls[i])) - << false << QString("pre%1post").arg(QLatin1Char(controls[i])); + for (char control : controls) { + const QString scheme = QLatin1String("pre") + QLatin1Char(control) + QLatin1String("post"); + QTest::newRow((QByteArrayLiteral("with-") + control).constData()) + << (scheme + QLatin1String("://example.com/")) + << false << scheme; + } } void tst_QUrl::schemeValidator() @@ -4074,13 +4076,12 @@ public: QVector<QUrl> m_urls; }; -static const UrlStorage * s_urlStorage = 0; +static const UrlStorage * s_urlStorage = nullptr; void tst_QUrl::testThreadingHelper() { const UrlStorage* storage = s_urlStorage; - for (int i = 0 ; i < storage->m_urls.size(); ++i ) { - const QUrl& u = storage->m_urls.at(i); + for (const auto &u : storage->m_urls) { // QVERIFY/QCOMPARE trigger race conditions in helgrind if (!u.isValid()) qFatal("invalid url"); |