summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/expectfail
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2012-01-12 13:16:44 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-13 01:41:14 +0100
commitfa078158920d40a8f39ab509521faa58b27f3749 (patch)
treec58d1937f790264d8a2c4e8a789fda6fd4399a91 /tests/auto/testlib/selftests/expectfail
parentced306d403bf2f8d5ca838a279b73d028a96db03 (diff)
Improve coverage of expectfail selftest.
Add a test for the case where QEXPECT_FAIL is called twice in a row without an intervening verification step, which is supposed to result in a failure. Change-Id: Ie004652a76a2c35c2679945670ff5561e8f5b62e 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.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp
index 8f67afc5ae..73d3e0c96a 100644
--- a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp
+++ b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp
@@ -52,6 +52,7 @@ class tst_ExpectFail: public QObject
private slots:
void expectAndContinue() const;
void expectAndAbort() const;
+ void expectTwice() const;
void xfailWithQString() const;
void xpass() const;
void dataDrivenTest_data() const;
@@ -76,6 +77,16 @@ void tst_ExpectFail::expectAndAbort() const
QVERIFY2(false, "This should not be reached");
}
+void tst_ExpectFail::expectTwice() const
+{
+ QEXPECT_FAIL("", "Calling QEXPECT_FAIL once is fine", Abort);
+ QEXPECT_FAIL("", "Calling QEXPECT_FAIL when already expecting a failure is "
+ "an error and should abort this test function", Abort);
+
+ // If we get here the test did not correctly abort on the double call to QEXPECT_FAIL.
+ QVERIFY2(false, "This should not be reached");
+}
+
void tst_ExpectFail::xfailWithQString() const
{
QEXPECT_FAIL("", QString("A string").toLatin1().constData(), Continue);