summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/expectfail
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2012-02-01 14:53:33 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-02 05:42:07 +0100
commitef25df9fec7aea220843de8e483a0922e0db1e50 (patch)
treed3c186ee27f2d88ba371ce98d23b1260cec27bd4 /tests/auto/testlib/selftests/expectfail
parent4d1dcaef19cff4e722dff06126f69077f20e23a5 (diff)
Add selftest for xpass in a data-driven test.
Change-Id: I9491d1e17ad31453ec353a11c9efb31522a16459 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.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp
index 1fa3711990..3a000ba182 100644
--- a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp
+++ b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp
@@ -61,6 +61,8 @@ private slots:
void xfailOnAnyRow_data() const;
void xfailOnAnyRow() const;
void xpass() const;
+ void xpassDataDriven_data() const;
+ void xpassDataDriven() const;
};
void tst_ExpectFail::xfailAndContinue() const
@@ -176,5 +178,26 @@ void tst_ExpectFail::xpass() const
QVERIFY2(false, "This should not be reached");
}
+void tst_ExpectFail::xpassDataDriven_data() const
+{
+ QTest::addColumn<bool>("shouldXPass");
+
+ QTest::newRow("XPass") << true;
+ QTest::newRow("Pass") << false;
+}
+
+void tst_ExpectFail::xpassDataDriven() const
+{
+ QFETCH(bool, shouldXPass);
+
+ if (shouldXPass)
+ QEXPECT_FAIL(QTest::currentDataTag(), "This test should xpass", Abort);
+
+ QVERIFY(true);
+
+ // We should only get here if the test wasn't supposed to xpass.
+ QVERIFY2(!shouldXPass, "Test failed to terminate on XPASS");
+}
+
QTEST_MAIN(tst_ExpectFail)
#include "tst_expectfail.moc"