Make selftest for QEXPECT_FAIL more robust.
authorJason McDonald <jason.mcdonald@nokia.com>
Wed, 11 Jan 2012 06:26:03 +0000 (16:26 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 12 Jan 2012 05:41:35 +0000 (06:41 +0100)
Make the test fail if calling QEXPECT_FAIL with the mode set to Abort
does not cause the current test function to abort.  Previously, such an
error would not cause the selftest to fail and someone would have to see
the warning message in the test output to know that there is a problem.

Change-Id: I2bd58fafe6b51ea0ab86fde7c5afb781e4534ee4
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp

index 28b00dc..09ba319 100644 (file)
@@ -70,7 +70,9 @@ void tst_ExpectFail::expectAndAbort() const
     qDebug("begin");
     QEXPECT_FAIL("", "This should xfail", Abort);
     QVERIFY(false);
-    qDebug("this should not be reached");
+
+    // If we get here the test did not correctly abort on the previous QVERIFY.
+    QVERIFY2(false, "This should not be reached");
 }
 
 void tst_ExpectFail::xfailWithQString() const