testlib: make XPASS output slightly less confusing.
Prior to this commit, when an unexpected pass occurred the test output showed the message "XPASS : tst_foo::function() 'expr' returned FALSE", where the problem was actually that the expression evaluated to true when it was expected to be false. This commit changes the output to make it clear that the expression evaluated to true unexpectedly. Task-number: QTBUG-22118 Change-Id: Id22c178073d3b75789675ca37a8ef019029b1f91 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
parent
02140e973b
commit
f64f428b81
@ -237,7 +237,10 @@ bool QTestResult::verify(bool statement, const char *statementStr,
|
||||
QTestLog::info(msg, file, line);
|
||||
}
|
||||
|
||||
qsnprintf(msg, 1024, "'%s' returned FALSE. (%s)", statementStr, description);
|
||||
const char * format = QTest::expectFailMode
|
||||
? "'%s' returned TRUE unexpectedly. (%s)"
|
||||
: "'%s' returned FALSE. (%s)";
|
||||
qsnprintf(msg, 1024, format, statementStr, description);
|
||||
|
||||
return checkStatement(statement, msg, file, line);
|
||||
}
|
||||
|
@ -95,13 +95,13 @@
|
||||
</TestFunction>
|
||||
<TestFunction name="xpass">
|
||||
<Incident type="xpass" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="190">
|
||||
<Description><![CDATA['true' returned FALSE. ()]]></Description>
|
||||
<Description><![CDATA['true' returned TRUE unexpectedly. ()]]></Description>
|
||||
</Incident>
|
||||
</TestFunction>
|
||||
<TestFunction name="xpassDataDriven">
|
||||
<Incident type="xpass" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="212">
|
||||
<DataTag><![CDATA[XPass]]></DataTag>
|
||||
<Description><![CDATA['true' returned FALSE. ()]]></Description>
|
||||
<Description><![CDATA['true' returned TRUE unexpectedly. ()]]></Description>
|
||||
</Incident>
|
||||
<Incident type="pass" file="" line="0">
|
||||
<DataTag><![CDATA[Pass]]></DataTag>
|
||||
|
@ -34,9 +34,9 @@ XFAIL : tst_ExpectFail::xfailOnAnyRow(second row) This test should xfail
|
||||
PASS : tst_ExpectFail::xfailOnAnyRow(second row)
|
||||
FAIL! : tst_ExpectFail::xfailWithoutVerify(first row) QEXPECT_FAIL was called without any subsequent verification statements
|
||||
FAIL! : tst_ExpectFail::xfailWithoutVerify(second row) QEXPECT_FAIL was called without any subsequent verification statements
|
||||
XPASS : tst_ExpectFail::xpass() 'true' returned FALSE. ()
|
||||
XPASS : tst_ExpectFail::xpass() 'true' returned TRUE unexpectedly. ()
|
||||
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(190)]
|
||||
XPASS : tst_ExpectFail::xpassDataDriven(XPass) 'true' returned FALSE. ()
|
||||
XPASS : tst_ExpectFail::xpassDataDriven(XPass) 'true' returned TRUE unexpectedly. ()
|
||||
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(212)]
|
||||
PASS : tst_ExpectFail::xpassDataDriven(Pass)
|
||||
PASS : tst_ExpectFail::cleanupTestCase()
|
||||
|
@ -97,13 +97,13 @@
|
||||
</TestFunction>
|
||||
<TestFunction name="xpass">
|
||||
<Incident type="xpass" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="190">
|
||||
<Description><![CDATA['true' returned FALSE. ()]]></Description>
|
||||
<Description><![CDATA['true' returned TRUE unexpectedly. ()]]></Description>
|
||||
</Incident>
|
||||
</TestFunction>
|
||||
<TestFunction name="xpassDataDriven">
|
||||
<Incident type="xpass" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp" line="212">
|
||||
<DataTag><![CDATA[XPass]]></DataTag>
|
||||
<Description><![CDATA['true' returned FALSE. ()]]></Description>
|
||||
<Description><![CDATA['true' returned TRUE unexpectedly. ()]]></Description>
|
||||
</Incident>
|
||||
<Incident type="pass" file="" line="0">
|
||||
<DataTag><![CDATA[Pass]]></DataTag>
|
||||
|
@ -35,10 +35,10 @@
|
||||
<failure tag="second row" message="QEXPECT_FAIL was called without any subsequent verification statements" result="fail"/>
|
||||
</testcase>
|
||||
<testcase result="xpass" name="xpass">
|
||||
<failure message="'true' returned FALSE. ()" result="xpass"/>
|
||||
<failure message="'true' returned TRUE unexpectedly. ()" result="xpass"/>
|
||||
</testcase>
|
||||
<testcase result="xpass" name="xpassDataDriven">
|
||||
<failure tag="XPass" message="'true' returned FALSE. ()" result="xpass"/>
|
||||
<failure tag="XPass" message="'true' returned TRUE unexpectedly. ()" result="xpass"/>
|
||||
</testcase>
|
||||
<testcase result="pass" name="cleanupTestCase"/>
|
||||
<system-err>
|
||||
|
@ -45,7 +45,7 @@
|
||||
</TestFunction>
|
||||
<TestFunction name="testFunc7">
|
||||
<Incident type="xpass" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/xunit/tst_xunit.cpp" line="110">
|
||||
<Description><![CDATA['true' returned FALSE. ()]]></Description>
|
||||
<Description><![CDATA['true' returned TRUE unexpectedly. ()]]></Description>
|
||||
</Incident>
|
||||
</TestFunction>
|
||||
<TestFunction name="cleanupTestCase">
|
||||
|
@ -19,7 +19,7 @@ PASS : tst_Xunit::testFunc5()
|
||||
XFAIL : tst_Xunit::testFunc6() this failure is also expected
|
||||
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/xunit/tst_xunit.cpp(104)]
|
||||
PASS : tst_Xunit::testFunc6()
|
||||
XPASS : tst_Xunit::testFunc7() 'true' returned FALSE. ()
|
||||
XPASS : tst_Xunit::testFunc7() 'true' returned TRUE unexpectedly. ()
|
||||
Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/xunit/tst_xunit.cpp(110)]
|
||||
PASS : tst_Xunit::cleanupTestCase()
|
||||
Totals: 5 passed, 3 failed, 1 skipped
|
||||
|
@ -47,7 +47,7 @@
|
||||
</TestFunction>
|
||||
<TestFunction name="testFunc7">
|
||||
<Incident type="xpass" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/xunit/tst_xunit.cpp" line="110">
|
||||
<Description><![CDATA['true' returned FALSE. ()]]></Description>
|
||||
<Description><![CDATA['true' returned TRUE unexpectedly. ()]]></Description>
|
||||
</Incident>
|
||||
</TestFunction>
|
||||
<TestFunction name="cleanupTestCase">
|
||||
|
@ -27,7 +27,7 @@
|
||||
<!-- message="this failure is also expected" type="info" -->
|
||||
</testcase>
|
||||
<testcase result="xpass" name="testFunc7">
|
||||
<failure message="'true' returned FALSE. ()" result="xpass"/>
|
||||
<failure message="'true' returned TRUE unexpectedly. ()" result="xpass"/>
|
||||
</testcase>
|
||||
<testcase result="pass" name="cleanupTestCase"/>
|
||||
<system-err>
|
||||
|
Loading…
Reference in New Issue
Block a user