From a93a9ea915332196821db9c197856955bedbfd26 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 11 Jun 2021 14:33:41 +0200 Subject: Fix QFAIL() to interract correctly with QEXPECT_FAIL() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, it went direct to QTestResults::addFailure() without going via the checking for expected failure. Add QTestResults::fail() to take care of this checking, as for verify() and compare(). Tidied up the code implementing expected failure and QFAIL(), while I was about it. Adjusted an existing test to verify that expecting a QFAIL() works, by using QFAIL() instead of QVERIFY(false). Remove the QVERIFY(false) whose comment brought this to my attention. [ChangeLog][QtTestLib][QFAIL] QEXPECT_FAIL() now correctly anticipates a subsequent QFAIL(). Previously QFAIL() counted as a fail regardless. Change-Id: Icc28cf70e5ff3006363791ea03aa01f2f591eb71 Reviewed-by: Qt CI Bot Reviewed-by: MÃ¥rten Nordheim --- tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tests/auto/network') diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 22f5f3f4c7..1239e70ee3 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2017 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** @@ -442,7 +442,6 @@ void tst_QUdpSocket::broadcasting() QEXPECT_FAIL("", "Broadcasting to 255.255.255.255 does not work on FreeBSD", Abort); - QVERIFY(false); // seems that QFAIL() doesn't respect the QEXPECT_FAIL() :/ #endif QFAIL("Network operation timed out"); } -- cgit v1.2.3