Add test-case for TAP logging glitch

The recently added test for QTestEventLoop produced a message which
the TAP test-logger mis-parses. Since that message shall soon go away
(when I fix the bug the new test exists to verify), modify one of
cmptest's QVERIFY2() messages to trip up the same bug, so we can spot
any regressions on this in future (after the imminent fix to this TAP
issue).

Change-Id: Ibbe9931c01c75df529c9571e2bbdbd34010dd9ec
Reviewed-by: Jason McDonald <macadder1@gmail.com>
This commit is contained in:
Edward Welbourne 2022-08-01 17:10:44 +02:00
parent 73a2320278
commit 16f5132b21
7 changed files with 11 additions and 7 deletions

View File

@ -12,6 +12,7 @@
#include <QtGui/QVector3D>
#include <QtGui/QVector4D>
#endif
using namespace Qt::StringLiterals;
/* XPM test data for QPixmap, QImage tests (use drag cursors as example) */
@ -647,7 +648,10 @@ void tst_Cmptest::verify()
void tst_Cmptest::verify2()
{
QVERIFY2(opaqueFunc() > 2, QByteArray::number(opaqueFunc()).constData());
QVERIFY2(opaqueFunc() < 2, QByteArray::number(opaqueFunc()).constData());
QVERIFY2(opaqueFunc() < 2,
// Message with parenthetical part, to catch mis-parses of the
// resulting message:
u"%1 >= 2 (as expected, in fact)"_s.arg(opaqueFunc()).toUtf8().constData());
}
class DeferredFlag : public QObject // Can't be const.

View File

@ -295,7 +295,7 @@
<failure type="fail" message="&apos;opaqueFunc() &lt; 2&apos; returned FALSE. ()"/>
</testcase>
<testcase name="verify2" classname="tst_Cmptest" time="@TEST_DURATION@">
<failure type="fail" message="&apos;opaqueFunc() &lt; 2&apos; returned FALSE. (42)"/>
<failure type="fail" message="&apos;opaqueFunc() &lt; 2&apos; returned FALSE. (42 &gt;= 2 (as expected, in fact))"/>
</testcase>
<testcase name="tryVerify" classname="tst_Cmptest" time="@TEST_DURATION@">
<failure type="fail" message="&apos;!c&apos; returned FALSE. ()"/>

View File

@ -396,7 +396,7 @@
</TestFunction>
<TestFunction name="verify2">
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42 >= 2 (as expected, in fact))]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>

View File

@ -547,7 +547,7 @@ not ok 65 - verify()
not ok 66 - verify2()
---
type: QVERIFY
message: 42
message: as expected, in fact)
wanted: true (opaqueFunc() < 2)
found: false (opaqueFunc() < 2)
expected: true (opaqueFunc() < 2)

View File

@ -177,7 +177,7 @@
##teamcity[testFailed name='verify()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()' flowId='tst_Cmptest']
##teamcity[testFinished name='verify()' flowId='tst_Cmptest']
##teamcity[testStarted name='verify2()' flowId='tst_Cmptest']
##teamcity[testFailed name='verify2()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)' flowId='tst_Cmptest']
##teamcity[testFailed name='verify2()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42 >= 2 (as expected, in fact))' flowId='tst_Cmptest']
##teamcity[testFinished name='verify2()' flowId='tst_Cmptest']
##teamcity[testStarted name='tryVerify()' flowId='tst_Cmptest']
##teamcity[testFailed name='tryVerify()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='|'!c|' returned FALSE. ()' flowId='tst_Cmptest']

View File

@ -198,7 +198,7 @@ FAIL! : tst_Cmptest::tryCompare() Compared values are not the same
Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::verify() 'opaqueFunc() < 2' returned FALSE. ()
Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::verify2() 'opaqueFunc() < 2' returned FALSE. (42)
FAIL! : tst_Cmptest::verify2() 'opaqueFunc() < 2' returned FALSE. (42 >= 2 (as expected, in fact))
Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
QINFO : tst_Cmptest::tryVerify() Should now time out and fail
FAIL! : tst_Cmptest::tryVerify() '!c' returned FALSE. ()

View File

@ -398,7 +398,7 @@
</TestFunction>
<TestFunction name="verify2">
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42 >= 2 (as expected, in fact))]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>