From 744313ae79e53d618dbc8dd6f02787d2d1c0d22b Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Tue, 2 Jan 2024 21:54:02 +0100 Subject: [PATCH] tst_QHostInfo::reverseLookup(): code cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove redundant curly braces. Use constFirst() instead of first() on a temporary list object. Task-number: QTBUG-120460 Pick-to: 6.6 6.5 Change-Id: Id643b20dfa5a541fea56abfdbcf933245a8a3c9d Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Thiago Macieira (cherry picked from commit 3c5e37fe0ff761bd4ee4eeea67881ec7b8eadad5) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index 195cf972d9e..b81ead7e80c 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -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);