summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/expected_cmptest.xml
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-07-09 16:12:40 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-07-10 03:08:32 +0000
commit54b276be0b5885bbaee2c38f472eb39731fd684a (patch)
tree54930bb8584873a4d4db9845d8722dae4c556fcc /tests/auto/testlib/selftests/expected_cmptest.xml
parent07ada0b971a84483f3676b5fef46ff2bd6d26dbb (diff)
testlib: Don't print QCOMPARE values if they lack string representation
Before 0681a2dd5a8095baddb5905fb21a58ce19b958c5, QCOMPARE'ing types for which no QTest::toString specialization exists did not output Actual and Expected lines on failure, as that would only print <null> for both values (which then look like the same value, confusingly). Commit 0681a2dd5a8095baddb5905fb21a58ce19b958c5 changed that behavior, and started printing the confusing <null> values. Take care of the logic in the formatFailMessage function: if both values are nullptr, then print only the variable names, but not the confusing <null> text representation of the values. Remove dead and duplicated code related to the formatting logic, add a self-test function, and update the expected_cmptest files. Fixes: QTBUG-104867 Pick-to: 6.4 Change-Id: I4be98e79f91196b14690a2cc0a68ffd50b431a45 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/testlib/selftests/expected_cmptest.xml')
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.xml8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/testlib/selftests/expected_cmptest.xml b/tests/auto/testlib/selftests/expected_cmptest.xml
index 509dca88b7..08c8d4694f 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.xml
+++ b/tests/auto/testlib/selftests/expected_cmptest.xml
@@ -111,6 +111,14 @@
</Incident>
<Duration msecs="0"/>
</TestFunction>
+ <TestFunction name="compare_unknown">
+ <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
+ <Description><![CDATA[Compared values are not the same
+ Actual : a
+ Expected : b]]></Description>
+ </Incident>
+ <Duration msecs="0"/>
+ </TestFunction>
<TestFunction name="compareQObjects">
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared QObject pointers are not the same