tst_QHostInfo::reverseLookup(): code cleanup

Remove redundant curly braces.
Use constFirst() instead of first() on a temporary list object.

Task-number: QTBUG-120460
Pick-to: 6.5
Change-Id: Id643b20dfa5a541fea56abfdbcf933245a8a3c9d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3c5e37fe0ff761bd4ee4eeea67881ec7b8eadad5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 744313ae79e53d618dbc8dd6f02787d2d1c0d22b)
This commit is contained in:
Axel Spoerl 2024-01-02 21:54:02 +01:00 committed by Qt Cherry-pick Bot
parent ecd3b57257
commit 0ecb6b0180

View File

@ -440,9 +440,8 @@ void tst_QHostInfo::reverseLookup()
QFETCH(int, err);
QFETCH(bool, ipv6);
if (ipv6 && !ipv6LookupsAvailable) {
if (ipv6 && !ipv6LookupsAvailable)
QSKIP("IPv6 reverse lookups are not supported on this platform");
}
QHostInfo info = QHostInfo::fromName(address);
@ -450,7 +449,7 @@ void tst_QHostInfo::reverseLookup()
if (!hostNames.contains(info.hostName()))
qDebug() << "Failure: expecting" << hostNames << ",got " << info.hostName();
QVERIFY(hostNames.contains(info.hostName()));
QCOMPARE(info.addresses().first(), QHostAddress(address));
QCOMPARE(info.addresses().constFirst(), QHostAddress(address));
} else {
QCOMPARE(info.hostName(), address);
QCOMPARE(info.error(), QHostInfo::HostNotFound);