From dfbb2d6e1db3f23c89c0b09ef32fd886b176e4b8 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 10 Aug 2021 12:28:42 +0200 Subject: [PATCH] Clarify documentation of QEXPECT_FAIL()'s mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Present behavior is to continue or abort, according to the mode, regardless of whether the condition marked does fail. Change-Id: I2eb5eefbbf173326101d08f3bbb378d214e93e71 Reviewed-by: Tor Arne Vestbø Reviewed-by: Paul Wicking --- src/testlib/doc/src/qttestlib-manual.qdoc | 4 ++-- src/testlib/qtestcase.qdoc | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc index 9073cc7c88..ff02ab876d 100644 --- a/src/testlib/doc/src/qttestlib-manual.qdoc +++ b/src/testlib/doc/src/qttestlib-manual.qdoc @@ -921,8 +921,8 @@ QSKIP can be used to skip testing when the implementation is not yet complete or not supported on a certain platform. When there are known - failures, it is recommended to use QEXPECT_FAIL, so that the test is - always completely executed. + failures, QEXPECT_FAIL is recommended, as it supports running the rest + of the test, when possible. Example of QSKIP in a test function: diff --git a/src/testlib/qtestcase.qdoc b/src/testlib/qtestcase.qdoc index 4534f3284f..2cc0038056 100644 --- a/src/testlib/qtestcase.qdoc +++ b/src/testlib/qtestcase.qdoc @@ -454,7 +454,8 @@ \a comment will be appended to the test log for the expected failure. \a mode is a \l QTest::TestFailMode and sets whether the test should - continue to execute or not. + continue to execute or not. The \a mode is applied regardless of + whether the expected test failure occurs. \note This macro can only be used in a test function that is invoked by the test framework. @@ -471,7 +472,7 @@ \snippet code/src_qtestlib_qtestcase.cpp 10 The above testfunction will not continue executing for the test data - entry \c{data27}. + entry \c{data27} (regardless of the value of \c i). \sa QTest::TestFailMode, QVERIFY(), QCOMPARE() */ @@ -632,14 +633,16 @@ /*! \enum QTest::TestFailMode - This enum describes the modes for handling an expected failure of the - \l QVERIFY() or \l QCOMPARE() macros. + This enum describes the modes for handling a check, such as by \l + QVERIFY() or \l QCOMPARE() macros, that is known to fail. The mode + applies regardless of whether the check fails or succeeds. - \value Abort Aborts the execution of the test. Use this mode when it - doesn't make sense to execute the test any further after the - expected failure. + \value Abort Aborts the execution of the test. Use this mode when + it doesn't make sense to execute the test any further after + the problematic check. - \value Continue Continues execution of the test after the expected failure. + \value Continue Continues execution of the test after the + problematic check. \sa QEXPECT_FAIL() */