QSslSocket manual test: replace QList with const array
"Never use a dynamically-sized container for statically-sized data." Port the loop from Q_FOREACH (which can't deal with arrays) to ranged for (which can). Pick-to: 6.6 6.5 Task-number: QTBUG-115839 Change-Id: Ib89d07fb751e3905a230ee5641e2e509e9415bed Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
parent
5cf3d062f6
commit
ba4b88d9d2
@ -30,14 +30,15 @@ void tst_QSslSocket::nextProtocolNegotiation_data()
|
|||||||
QTest::addColumn<QByteArray>("expectedProtocol");
|
QTest::addColumn<QByteArray>("expectedProtocol");
|
||||||
QTest::addColumn<QSslConfiguration::NextProtocolNegotiationStatus>("expectedStatus");
|
QTest::addColumn<QSslConfiguration::NextProtocolNegotiationStatus>("expectedStatus");
|
||||||
|
|
||||||
QList<QString> hosts = QList<QString>()
|
const QString hosts[] = {
|
||||||
<< QStringLiteral("www.google.com")
|
QStringLiteral("www.google.com"),
|
||||||
<< QStringLiteral("www.facebook.com")
|
QStringLiteral("www.facebook.com"),
|
||||||
<< QStringLiteral("www.twitter.com")
|
QStringLiteral("www.twitter.com"),
|
||||||
<< QStringLiteral("graph.facebook.com")
|
QStringLiteral("graph.facebook.com"),
|
||||||
<< QStringLiteral("api.twitter.com");
|
QStringLiteral("api.twitter.com"),
|
||||||
|
};
|
||||||
|
|
||||||
foreach (QString host, hosts) {
|
for (const QString &host : hosts) {
|
||||||
QByteArray tag = host.toLocal8Bit();
|
QByteArray tag = host.toLocal8Bit();
|
||||||
tag.append("-none");
|
tag.append("-none");
|
||||||
QTest::newRow(tag)
|
QTest::newRow(tag)
|
||||||
|
Loading…
Reference in New Issue
Block a user