From d65512d9f61413c41b0828b0e1e446dd9fbc488c Mon Sep 17 00:00:00 2001 From: nowrep Date: Sat, 1 Feb 2014 17:55:20 +0100 Subject: [PATCH] [PACTest] Correctly accept localhost resolved IPv4/6 addresses --- tests/autotests/pactest.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/autotests/pactest.cpp b/tests/autotests/pactest.cpp index 5dc87160c..2ad789565 100644 --- a/tests/autotests/pactest.cpp +++ b/tests/autotests/pactest.cpp @@ -159,7 +159,7 @@ void PacTest::dnsResolveTest_data() QTest::addColumn("host"); QTest::addColumn("result"); - QTest::newRow("localhost") << "localhost" << "127.0.0.1"; + QTest::newRow("localhost") << "localhost" << ""; QTest::newRow("qz") << "qupzilla.com" << "85.118.128.38"; // This may change... } @@ -169,7 +169,16 @@ void PacTest::dnsResolveTest() QFETCH(QString, result); QString source = QString("dnsResolve('%1')").arg(host); - QCOMPARE(m_runner->evaluate(source).toString(), result); + QString res = m_runner->evaluate(source).toString(); + + if (host == "localhost") { + if (res != "127.0.0.1" && res != "::1") { + QFAIL("localhost incorrectly resolved!"); + } + return; + } + + QCOMPARE(res, result); } void PacTest::dnsDomainLevelsTest_data()