diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-01-20 16:03:30 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-02-15 06:35:43 +0000 |
commit | f5b609cac864e010085d5965b84832b2d85643e6 (patch) | |
tree | ccb339e9bb957c25591192b62590158d867f5d84 /tests | |
parent | 8d9d2a7b8568c4c067252e6ca9eea45de7a743a5 (diff) | |
download | qtbase-f5b609cac864e010085d5965b84832b2d85643e6.tar.gz |
Make the printing of complex byte arrays prettier
Similar to what we've done to QString, only we print each byte that is
not ASCII as \OOO (octal representation).
[ChangeLog][QtTest] QtTest now prints an escaped version of
QByteArrays that failed to compare with QCOMPARE, instead of the hex
dump.
Change-Id: I6a8c43f138c66c998280998a242b43cd579666a0
Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/testlib/selftests/expected_strcmp.lightxml | 20 | ||||
-rw-r--r-- | tests/auto/testlib/selftests/expected_strcmp.txt | 30 | ||||
-rw-r--r-- | tests/auto/testlib/selftests/expected_strcmp.xml | 20 | ||||
-rw-r--r-- | tests/auto/testlib/selftests/expected_strcmp.xunitxml | 20 | ||||
-rw-r--r-- | tests/auto/testlib/selftests/tst_selftests.cpp | 2 |
5 files changed, 46 insertions, 46 deletions
diff --git a/tests/auto/testlib/selftests/expected_strcmp.lightxml b/tests/auto/testlib/selftests/expected_strcmp.lightxml index 298e910be8..93a860431e 100644 --- a/tests/auto/testlib/selftests/expected_strcmp.lightxml +++ b/tests/auto/testlib/selftests/expected_strcmp.lightxml @@ -23,40 +23,40 @@ </Incident> <Incident type="fail" file="tst_strcmp.cpp" line="109"> <Description><![CDATA[Compared values are not the same - Actual (a): 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 ... - Expected (b): 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 ...]]></Description> + Actual (a): "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"... + Expected (b): "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"...]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="failByteArray"> <Incident type="fail" file="tst_strcmp.cpp" line="115"> <Description><![CDATA[Compared values are not the same - Actual (QByteArray("abc")): 61 62 63 - Expected (QByteArray("cba")): 63 62 61]]></Description> + Actual (QByteArray("abc")): "abc" + Expected (QByteArray("cba")): "cba"]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="failByteArrayNull"> <Incident type="fail" file="tst_strcmp.cpp" line="121"> <Description><![CDATA[Compared values are not the same - Actual (QByteArray("foo")): 66 6F 6F - Expected (QByteArray()) : ]]></Description> + Actual (QByteArray("foo")): "foo" + Expected (QByteArray()) : ""]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="failByteArrayEmpty"> <Incident type="fail" file="tst_strcmp.cpp" line="126"> <Description><![CDATA[Compared values are not the same - Actual (QByteArray("")) : - Expected (QByteArray("foo")): 66 6F 6F]]></Description> + Actual (QByteArray("")) : "" + Expected (QByteArray("foo")): "foo"]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="failByteArraySingleChars"> <Incident type="fail" file="tst_strcmp.cpp" line="133"> <Description><![CDATA[Compared values are not the same - Actual (QByteArray("6")): 36 - Expected (QByteArray("7")): 37]]></Description> + Actual (QByteArray("6")): "6" + Expected (QByteArray("7")): "7"]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_strcmp.txt b/tests/auto/testlib/selftests/expected_strcmp.txt index 3d58698781..270ce09892 100644 --- a/tests/auto/testlib/selftests/expected_strcmp.txt +++ b/tests/auto/testlib/selftests/expected_strcmp.txt @@ -9,25 +9,25 @@ XFAIL : tst_StrCmp::compareByteArray() Next test should fail XFAIL : tst_StrCmp::compareByteArray() Next test should fail Loc: [tst_strcmp.cpp(102)] FAIL! : tst_StrCmp::compareByteArray() Compared values are not the same - Actual (a): 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 ... - Expected (b): 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 ... - Loc: [tst_strcmp.cpp(109)] + Actual (a): "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"... + Expected (b): "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"... + Loc: [/home/thiago/src/qt/qt5/qtbase/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp(109)] FAIL! : tst_StrCmp::failByteArray() Compared values are not the same - Actual (QByteArray("abc")): 61 62 63 - Expected (QByteArray("cba")): 63 62 61 - Loc: [tst_strcmp.cpp(115)] + Actual (QByteArray("abc")): "abc" + Expected (QByteArray("cba")): "cba" + Loc: [/home/thiago/src/qt/qt5/qtbase/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp(115)] FAIL! : tst_StrCmp::failByteArrayNull() Compared values are not the same - Actual (QByteArray("foo")): 66 6F 6F - Expected (QByteArray()) : - Loc: [tst_strcmp.cpp(121)] + Actual (QByteArray("foo")): "foo" + Expected (QByteArray()) : "" + Loc: [/home/thiago/src/qt/qt5/qtbase/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp(121)] FAIL! : tst_StrCmp::failByteArrayEmpty() Compared values are not the same - Actual (QByteArray("")) : - Expected (QByteArray("foo")): 66 6F 6F - Loc: [tst_strcmp.cpp(126)] + Actual (QByteArray("")) : "" + Expected (QByteArray("foo")): "foo" + Loc: [/home/thiago/src/qt/qt5/qtbase/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp(126)] FAIL! : tst_StrCmp::failByteArraySingleChars() Compared values are not the same - Actual (QByteArray("6")): 36 - Expected (QByteArray("7")): 37 - Loc: [tst_strcmp.cpp(133)] + Actual (QByteArray("6")): "6" + Expected (QByteArray("7")): "7" + Loc: [/home/thiago/src/qt/qt5/qtbase/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp(133)] PASS : tst_StrCmp::cleanupTestCase() Totals: 3 passed, 5 failed, 0 skipped, 0 blacklisted ********* Finished testing of tst_StrCmp ********* diff --git a/tests/auto/testlib/selftests/expected_strcmp.xml b/tests/auto/testlib/selftests/expected_strcmp.xml index 29208f9a87..9e14dddd7c 100644 --- a/tests/auto/testlib/selftests/expected_strcmp.xml +++ b/tests/auto/testlib/selftests/expected_strcmp.xml @@ -25,40 +25,40 @@ </Incident> <Incident type="fail" file="tst_strcmp.cpp" line="109"> <Description><![CDATA[Compared values are not the same - Actual (a): 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 ... - Expected (b): 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 ...]]></Description> + Actual (a): "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"... + Expected (b): "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"...]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="failByteArray"> <Incident type="fail" file="tst_strcmp.cpp" line="115"> <Description><![CDATA[Compared values are not the same - Actual (QByteArray("abc")): 61 62 63 - Expected (QByteArray("cba")): 63 62 61]]></Description> + Actual (QByteArray("abc")): "abc" + Expected (QByteArray("cba")): "cba"]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="failByteArrayNull"> <Incident type="fail" file="tst_strcmp.cpp" line="121"> <Description><![CDATA[Compared values are not the same - Actual (QByteArray("foo")): 66 6F 6F - Expected (QByteArray()) : ]]></Description> + Actual (QByteArray("foo")): "foo" + Expected (QByteArray()) : ""]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="failByteArrayEmpty"> <Incident type="fail" file="tst_strcmp.cpp" line="126"> <Description><![CDATA[Compared values are not the same - Actual (QByteArray("")) : - Expected (QByteArray("foo")): 66 6F 6F]]></Description> + Actual (QByteArray("")) : "" + Expected (QByteArray("foo")): "foo"]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="failByteArraySingleChars"> <Incident type="fail" file="tst_strcmp.cpp" line="133"> <Description><![CDATA[Compared values are not the same - Actual (QByteArray("6")): 36 - Expected (QByteArray("7")): 37]]></Description> + Actual (QByteArray("6")): "6" + Expected (QByteArray("7")): "7"]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_strcmp.xunitxml b/tests/auto/testlib/selftests/expected_strcmp.xunitxml index 14bef9ec47..66dce857c9 100644 --- a/tests/auto/testlib/selftests/expected_strcmp.xunitxml +++ b/tests/auto/testlib/selftests/expected_strcmp.xunitxml @@ -12,28 +12,28 @@ <!-- message="Next test should fail" type="info" --> <!-- message="Next test should fail" type="info" --> <failure message="Compared values are not the same - Actual (a): 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 ... - Expected (b): 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 ..." result="fail"/> + Actual (a): "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"... + Expected (b): "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"..." result="fail"/> </testcase> <testcase result="fail" name="failByteArray"> <failure message="Compared values are not the same - Actual (QByteArray("abc")): 61 62 63 - Expected (QByteArray("cba")): 63 62 61" result="fail"/> + Actual (QByteArray("abc")): "abc" + Expected (QByteArray("cba")): "cba"" result="fail"/> </testcase> <testcase result="fail" name="failByteArrayNull"> <failure message="Compared values are not the same - Actual (QByteArray("foo")): 66 6F 6F - Expected (QByteArray()) : " result="fail"/> + Actual (QByteArray("foo")): "foo" + Expected (QByteArray()) : """ result="fail"/> </testcase> <testcase result="fail" name="failByteArrayEmpty"> <failure message="Compared values are not the same - Actual (QByteArray("")) : - Expected (QByteArray("foo")): 66 6F 6F" result="fail"/> + Actual (QByteArray("")) : "" + Expected (QByteArray("foo")): "foo"" result="fail"/> </testcase> <testcase result="fail" name="failByteArraySingleChars"> <failure message="Compared values are not the same - Actual (QByteArray("6")): 36 - Expected (QByteArray("7")): 37" result="fail"/> + Actual (QByteArray("6")): "6" + Expected (QByteArray("7")): "7"" result="fail"/> </testcase> <testcase result="pass" name="cleanupTestCase"/> <system-err> diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index acd3faaa45..488b65c657 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -746,7 +746,7 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge .arg(i).arg(loggers.at(n), output))); } else { QVERIFY2(output == expected, - qPrintable(QString::fromLatin1("Mismatch at line %1 (%2, %3): '%4' != '%5'") + qPrintable(QString::fromLatin1("Mismatch at line %1 (%2, %3):\n'%4'\n !=\n'%5'") .arg(i + 1).arg(loggers.at(n), expectedFileName, output, expected))); } |