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>
This commit is contained in:
parent
45373c1924
commit
6fbf50248d
@ -2192,10 +2192,12 @@ void tst_QUrl::schemeValidator_data()
|
|||||||
QTest::newRow("percent-encoded") << "%68%74%%74%70://example.com" << false << "%68%74%%74%70";
|
QTest::newRow("percent-encoded") << "%68%74%%74%70://example.com" << false << "%68%74%%74%70";
|
||||||
|
|
||||||
static const char controls[] = "!\"$&'()*,;<=>[\\]^_`{|}~";
|
static const char controls[] = "!\"$&'()*,;<=>[\\]^_`{|}~";
|
||||||
for (size_t i = 0; i < sizeof(controls) - 1; ++i)
|
for (char control : controls) {
|
||||||
QTest::newRow(("with-" + QByteArray(1, controls[i])).constData())
|
const QString scheme = QLatin1String("pre") + QLatin1Char(control) + QLatin1String("post");
|
||||||
<< QString("pre%1post://example.com/").arg(QLatin1Char(controls[i]))
|
QTest::newRow((QByteArrayLiteral("with-") + control).constData())
|
||||||
<< false << QString("pre%1post").arg(QLatin1Char(controls[i]));
|
<< (scheme + QLatin1String("://example.com/"))
|
||||||
|
<< false << scheme;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QUrl::schemeValidator()
|
void tst_QUrl::schemeValidator()
|
||||||
@ -4074,13 +4076,12 @@ public:
|
|||||||
QVector<QUrl> m_urls;
|
QVector<QUrl> m_urls;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const UrlStorage * s_urlStorage = 0;
|
static const UrlStorage * s_urlStorage = nullptr;
|
||||||
|
|
||||||
void tst_QUrl::testThreadingHelper()
|
void tst_QUrl::testThreadingHelper()
|
||||||
{
|
{
|
||||||
const UrlStorage* storage = s_urlStorage;
|
const UrlStorage* storage = s_urlStorage;
|
||||||
for (int i = 0 ; i < storage->m_urls.size(); ++i ) {
|
for (const auto &u : storage->m_urls) {
|
||||||
const QUrl& u = storage->m_urls.at(i);
|
|
||||||
// QVERIFY/QCOMPARE trigger race conditions in helgrind
|
// QVERIFY/QCOMPARE trigger race conditions in helgrind
|
||||||
if (!u.isValid())
|
if (!u.isValid())
|
||||||
qFatal("invalid url");
|
qFatal("invalid url");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user