tst_QCborStreamWriter: port to QTEST_THROW_ON_FAIL
Dogfooding the new QtTest 6.8 feature. Pick-to: 6.8 Change-Id: Ie197dc94fb9dfebd5f730c7ca4ef5ce0ed07e9f3 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This commit is contained in:
parent
157fcdf5af
commit
eec0a30e5e
@ -6,7 +6,9 @@ if (NOT WASM) # QTBUG-121822
|
||||
add_subdirectory(qcborstreamreader)
|
||||
endif()
|
||||
if(QT_FEATURE_cborstreamwriter)
|
||||
if (NOT WASM) # QTBUG-121822
|
||||
add_subdirectory(qcborstreamwriter)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT WASM)
|
||||
add_subdirectory(qcborvalue)
|
||||
|
@ -16,4 +16,8 @@ qt_internal_add_test(tst_qcborstreamwriter
|
||||
tst_qcborstreamwriter.cpp
|
||||
INCLUDE_DIRECTORIES
|
||||
../../../../../src/3rdparty/tinycbor/tests
|
||||
NO_BATCH # QTBUG-121815
|
||||
DEFINES
|
||||
QTEST_THROW_ON_FAIL
|
||||
QTEST_THROW_ON_SKIP
|
||||
)
|
||||
|
@ -5,6 +5,10 @@
|
||||
#include <QCborStreamWriter>
|
||||
#include <QBuffer>
|
||||
|
||||
#ifndef QTEST_THROW_ON_FAIL
|
||||
# error This test requires QTEST_THROW_ON_FAIL being active.
|
||||
#endif
|
||||
|
||||
class tst_QCborStreamWriter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -247,18 +251,10 @@ void tst_QCborStreamWriter::arrays()
|
||||
QFETCH(QByteArray, output);
|
||||
|
||||
compare(make_list(input), "\x81" + output);
|
||||
if (QTest::currentTestFailed())
|
||||
return;
|
||||
|
||||
compare(make_list(input, input), "\x82" + output + output);
|
||||
if (QTest::currentTestFailed())
|
||||
return;
|
||||
|
||||
// nested lists
|
||||
compare(make_list(make_list(input)), "\x81\x81" + output);
|
||||
if (QTest::currentTestFailed())
|
||||
return;
|
||||
|
||||
compare(make_list(make_list(input), make_list(input)), "\x82\x81" + output + "\x81" + output);
|
||||
}
|
||||
|
||||
@ -268,9 +264,6 @@ void tst_QCborStreamWriter::maps()
|
||||
QFETCH(QByteArray, output);
|
||||
|
||||
compare(make_map({{1, input}}), "\xa1\1" + output);
|
||||
if (QTest::currentTestFailed())
|
||||
return;
|
||||
|
||||
compare(make_map({{1, input}, {input, 24}}), "\xa2\1" + output + output + "\x18\x18");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user