diff --git a/tests/auto/testlib/selftests/expected_expectfail.lightxml b/tests/auto/testlib/selftests/expected_expectfail.lightxml index 79e5827caa..76c8e31e4f 100644 --- a/tests/auto/testlib/selftests/expected_expectfail.lightxml +++ b/tests/auto/testlib/selftests/expected_expectfail.lightxml @@ -5,7 +5,7 @@ - + @@ -17,7 +17,7 @@ - + @@ -26,8 +26,8 @@ - - + + @@ -40,36 +40,36 @@ - - - - - - - + + - + - + - - + + - + + + + + + diff --git a/tests/auto/testlib/selftests/expected_expectfail.txt b/tests/auto/testlib/selftests/expected_expectfail.txt index b31245151d..c3a38edbb0 100644 --- a/tests/auto/testlib/selftests/expected_expectfail.txt +++ b/tests/auto/testlib/selftests/expected_expectfail.txt @@ -1,35 +1,35 @@ ********* Start testing of tst_ExpectFail ********* Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@ PASS : tst_ExpectFail::initTestCase() -QDEBUG : tst_ExpectFail::expectAndContinue() begin -XFAIL : tst_ExpectFail::expectAndContinue() This should xfail +QDEBUG : tst_ExpectFail::xfailAndContinue() begin +XFAIL : tst_ExpectFail::xfailAndContinue() This should xfail Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(70)] -QDEBUG : tst_ExpectFail::expectAndContinue() after -PASS : tst_ExpectFail::expectAndContinue() -QDEBUG : tst_ExpectFail::expectAndAbort() begin -XFAIL : tst_ExpectFail::expectAndAbort() This should xfail +QDEBUG : tst_ExpectFail::xfailAndContinue() after +PASS : tst_ExpectFail::xfailAndContinue() +QDEBUG : tst_ExpectFail::xfailAndAbort() begin +XFAIL : tst_ExpectFail::xfailAndAbort() This should xfail Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(78)] -PASS : tst_ExpectFail::expectAndAbort() -FAIL! : tst_ExpectFail::expectTwice() Already expecting a fail - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(87)] +PASS : tst_ExpectFail::xfailAndAbort() +FAIL! : tst_ExpectFail::xfailTwice() Already expecting a fail + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(88)] XFAIL : tst_ExpectFail::xfailWithQString() A string Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(97)] XFAIL : tst_ExpectFail::xfailWithQString() Bug 5 (The message) Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(102)] PASS : tst_ExpectFail::xfailWithQString() +XFAIL : tst_ExpectFail::xfailDataDriven(Abort) This test should xfail + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(131)] +XFAIL : tst_ExpectFail::xfailDataDriven(Continue) This test should xfail + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(131)] +PASS : tst_ExpectFail::xfailDataDriven() +PASS : tst_ExpectFail::xfailOnWrongRow() +XFAIL : tst_ExpectFail::xfailOnAnyRow(first row) This test should xfail + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(166)] +XFAIL : tst_ExpectFail::xfailOnAnyRow(second row) This test should xfail + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(166)] +PASS : tst_ExpectFail::xfailOnAnyRow() XPASS : tst_ExpectFail::xpass() 'true' returned FALSE. () - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(108)] -XFAIL : tst_ExpectFail::dataDrivenTest(Abort) This test should xfail - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(141)] -XFAIL : tst_ExpectFail::dataDrivenTest(Continue) This test should xfail - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(141)] -PASS : tst_ExpectFail::dataDrivenTest() -PASS : tst_ExpectFail::expectOnWrongRow() -XFAIL : tst_ExpectFail::expectOnAnyRow(first row) This test should xfail - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(176)] -XFAIL : tst_ExpectFail::expectOnAnyRow(second row) This test should xfail - Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(176)] -PASS : tst_ExpectFail::expectOnAnyRow() + Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(172)] PASS : tst_ExpectFail::cleanupTestCase() Totals: 8 passed, 2 failed, 0 skipped ********* Finished testing of tst_ExpectFail ********* diff --git a/tests/auto/testlib/selftests/expected_expectfail.xml b/tests/auto/testlib/selftests/expected_expectfail.xml index 676a030b3f..e195384727 100644 --- a/tests/auto/testlib/selftests/expected_expectfail.xml +++ b/tests/auto/testlib/selftests/expected_expectfail.xml @@ -7,7 +7,7 @@ - + @@ -19,7 +19,7 @@ - + @@ -28,8 +28,8 @@ - - + + @@ -42,36 +42,36 @@ - - - - - - - + + - + - + - - + + - + + + + + + diff --git a/tests/auto/testlib/selftests/expected_expectfail.xunitxml b/tests/auto/testlib/selftests/expected_expectfail.xunitxml index 328bb6433b..a94e1eaf47 100644 --- a/tests/auto/testlib/selftests/expected_expectfail.xunitxml +++ b/tests/auto/testlib/selftests/expected_expectfail.xunitxml @@ -1,38 +1,38 @@ - - + + - + - + - + - - - - + - - + + + + + diff --git a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp index 6c3143a6f1..1fa3711990 100644 --- a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp +++ b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp @@ -50,20 +50,20 @@ class tst_ExpectFail: public QObject Q_OBJECT private slots: - void expectAndContinue() const; - void expectAndAbort() const; - void expectTwice() const; + void xfailAndContinue() const; + void xfailAndAbort() const; + void xfailTwice() const; void xfailWithQString() const; + void xfailDataDriven_data() const; + void xfailDataDriven() const; + void xfailOnWrongRow_data() const; + void xfailOnWrongRow() const; + void xfailOnAnyRow_data() const; + void xfailOnAnyRow() const; void xpass() const; - void dataDrivenTest_data() const; - void dataDrivenTest() const; - void expectOnWrongRow_data() const; - void expectOnWrongRow() const; - void expectOnAnyRow_data() const; - void expectOnAnyRow() const; }; -void tst_ExpectFail::expectAndContinue() const +void tst_ExpectFail::xfailAndContinue() const { qDebug("begin"); QEXPECT_FAIL("", "This should xfail", Continue); @@ -71,7 +71,7 @@ void tst_ExpectFail::expectAndContinue() const qDebug("after"); } -void tst_ExpectFail::expectAndAbort() const +void tst_ExpectFail::xfailAndAbort() const { qDebug("begin"); QEXPECT_FAIL("", "This should xfail", Abort); @@ -81,7 +81,7 @@ void tst_ExpectFail::expectAndAbort() const QVERIFY2(false, "This should not be reached"); } -void tst_ExpectFail::expectTwice() const +void tst_ExpectFail::xfailTwice() const { QEXPECT_FAIL("", "Calling QEXPECT_FAIL once is fine", Abort); QEXPECT_FAIL("", "Calling QEXPECT_FAIL when already expecting a failure is " @@ -102,17 +102,7 @@ void tst_ExpectFail::xfailWithQString() const QVERIFY(false); } -void tst_ExpectFail::xpass() const -{ - QEXPECT_FAIL("", "This test should xpass", Abort); - QVERIFY(true); - - // If we get here the test did not correctly abort on the previous - // unexpected pass. - QVERIFY2(false, "This should not be reached"); -} - -void tst_ExpectFail::dataDrivenTest_data() const +void tst_ExpectFail::xfailDataDriven_data() const { QTest::addColumn("shouldPass"); QTest::addColumn("failMode"); @@ -123,7 +113,7 @@ void tst_ExpectFail::dataDrivenTest_data() const QTest::newRow("Continue") << false << QTest::Continue; } -void tst_ExpectFail::dataDrivenTest() const +void tst_ExpectFail::xfailDataDriven() const { QFETCH(bool, shouldPass); QFETCH(QTest::TestFailMode, failMode); @@ -146,21 +136,21 @@ void tst_ExpectFail::dataDrivenTest() const QCOMPARE(failMode, QTest::Continue); } -void tst_ExpectFail::expectOnWrongRow_data() const +void tst_ExpectFail::xfailOnWrongRow_data() const { QTest::addColumn("dummy"); QTest::newRow("right row") << 0; } -void tst_ExpectFail::expectOnWrongRow() const +void tst_ExpectFail::xfailOnWrongRow() const { // QEXPECT_FAIL for a row that is not the current row should be ignored. QEXPECT_FAIL("wrong row", "This xfail should be ignored", Abort); QVERIFY(true); } -void tst_ExpectFail::expectOnAnyRow_data() const +void tst_ExpectFail::xfailOnAnyRow_data() const { QTest::addColumn("dummy"); @@ -168,7 +158,7 @@ void tst_ExpectFail::expectOnAnyRow_data() const QTest::newRow("second row") << 1; } -void tst_ExpectFail::expectOnAnyRow() const +void tst_ExpectFail::xfailOnAnyRow() const { // In a data-driven test, passing an empty first parameter to QEXPECT_FAIL // should mean that the failure is expected for all data rows. @@ -176,5 +166,15 @@ void tst_ExpectFail::expectOnAnyRow() const QVERIFY(false); } +void tst_ExpectFail::xpass() const +{ + QEXPECT_FAIL("", "This test should xpass", Abort); + QVERIFY(true); + + // If we get here the test did not correctly abort on the previous + // unexpected pass. + QVERIFY2(false, "This should not be reached"); +} + QTEST_MAIN(tst_ExpectFail) #include "tst_expectfail.moc"