diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2012-01-12 14:57:08 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-13 04:04:17 +0100 |
commit | 0528d9dca7ec14e39bcae93c975069a517954e2e (patch) | |
tree | e94758447f82308655c69b6d24c84bd836178b7c /tests/auto/testlib/selftests/expectfail | |
parent | 3dfdf34c1c3ce3a2348aedc4192956e5884a914b (diff) |
Improve coverage of expectfail selftest
Add a test case for calling QEXPECT_FAIL in a data-driven test without
passing a specific data tag for the expected failure, in which the
expected failure should apply to the current data row.
Change-Id: I70a6592de77b1718c3a749fd2216e66f8f312805
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 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp index 4b9f3600ac..79325a3bfc 100644 --- a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp +++ b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp @@ -59,6 +59,8 @@ private slots: void dataDrivenTest() const; void expectOnWrongRow_data() const; void expectOnWrongRow() const; + void expectOnAnyRow_data() const; + void expectOnAnyRow() const; }; void tst_ExpectFail::expectAndContinue() const @@ -158,5 +160,21 @@ void tst_ExpectFail::expectOnWrongRow() const QVERIFY(true); } +void tst_ExpectFail::expectOnAnyRow_data() const +{ + QTest::addColumn<int>("dummy"); + + QTest::newRow("first row") << 0; + QTest::newRow("second row") << 1; +} + +void tst_ExpectFail::expectOnAnyRow() 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. + QEXPECT_FAIL("", "This test should xfail", Abort); + QVERIFY(false); +} + QTEST_MAIN(tst_ExpectFail) #include "tst_expectfail.moc" |