diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2012-02-01 14:33:42 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-02 05:42:07 +0100 |
commit | 4d1dcaef19cff4e722dff06126f69077f20e23a5 (patch) | |
tree | 7fd881026ca45808b2f8751ece0f72ed75349603 /tests/auto/testlib/selftests/expectfail | |
parent | 58c617c798c0d0db244735451acd316306068491 (diff) |
Improve readability of expectfail selftest.
Rename some of the test functions to improve consistency, and change the
order so that all the xfail tests are together (some new xpass tests
will be added later).
Change-Id: Ice1ac5bf61bc26109bb0d08f72eb74e1a0424101
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/testlib/selftests/expectfail')
-rw-r--r-- | tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
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<bool>("shouldPass"); QTest::addColumn<QTest::TestFailMode>("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<int>("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<int>("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" |