summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp')
-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);