qt6-bb10/tests/auto/testlib/selftests
Giuseppe D'Angelo 5560723e9d QCOMPARE: restore compatibility with braced-init-lists
a611a9f537 (in Qt 5) added support for
mixed-type comparisons through QCOMPARE. That commit added a new
overload for qCompare taking two types, T1 and T2; but it also left the
same-type qCompare(T, T) overload around, guarded by a Qt 6 version
check.

The mixed-type version is however not a generalization of the same-type
one, because it won't work if one of the arguments doesn't participate
in FTAD. Case in point: braced-init-lists. In Qt 5 this worked:

 QCOMPARE(some_container, {42});

but in Qt 6 it does not work any more. The mixed-type overload fails
deduction (can't deduce T2); in Qt 5 the same-type overload deduced
T=SomeContainer, and {42} was used to select a constructor for
SomeContainer.

--

There's a partial, straightforward workaround for this: default T2 to
T1 in the mized-type overload. In that case T2 has a "fallback" if it
cannot be deduced. This is partial because of course doesn't address
the case in which T1 cannot be deduced, but I don't think that is
common at all.

QList is special here, because it has qCompare overloads that makes it
comparable with arrays, initializer lists and more. I don't like that
very much -- we should probably have a qCompare(input_range,
input_range) overload, but that's an exercise for C++20.

Change-Id: I344ba33167829984978cd8d649a1904349a9edab
Pick-to: 6.5 6.6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-07 12:20:50 +02:00
..
assert tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
badxml tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
benchlibcallgrind Silence some conversion warnings 2023-03-10 17:36:13 +01:00
benchlibcounting Silence some conversion warnings 2023-03-10 17:36:13 +01:00
benchlibeventcounter Silence some conversion warnings 2023-03-10 17:36:13 +01:00
benchliboptions tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
benchlibtickcounter Silence some conversion warnings 2023-03-10 17:36:13 +01:00
benchlibwalltime tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
blacklisted tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
cmptest QCOMPARE: restore compatibility with braced-init-lists 2023-07-07 12:20:50 +02:00
commandlinedata tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
counting tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
crashes Suppress a redundant GCC warning 2023-05-04 02:03:51 +03:00
datatable tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
datetime tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
deleteLater tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
deleteLater_noApp tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
differentexec tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
eventloop QTestEventLoop: add enterLoop(std::chrono::milliseconds) overload 2023-03-03 21:36:48 +02:00
exceptionthrow tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
expectfail tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
extendedcompare tst_Selftests: rewrite this with templates instead of macro 2023-01-12 00:00:20 -07:00
failcleanup tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
failcleanuptestcase CMake: Don't use PUBLIC_LIBRARIES for tests and test helpers 2022-07-28 14:46:53 +02:00
faildatatype tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
failfetchtype tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
failinit tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
failinitdata tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
fetchbogus tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
findtestdata Testlib: fix the last few s/Q_OS_MAC/Q_OS_DARWIN/w 2023-03-20 19:18:52 +01:00
float tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
globaldata tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
junit tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
keyboard tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
longstring tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
maxwarnings tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
mouse tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
multiexec tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
pairdiagnostics tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
pass tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
patches
printdatatags tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
printdatatagswithglobaltags tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
qexecstringlist tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
signaldumper tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
silent tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
singleskip tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
skip tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
skipcleanup tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
skipcleanuptestcase CMake: Don't use PUBLIC_LIBRARIES for tests and test helpers 2022-07-28 14:46:53 +02:00
skipinit tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
skipinitdata tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
sleep selftests: tst_sleep, don't start timer twice 2023-06-30 02:24:54 +03:00
strcmp tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
subtest tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
testlib tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
tuplediagnostics tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
verbose1 Rid of 'special case' markers 2023-04-13 18:30:58 +02:00
verbose2 Rid of 'special case' markers 2023-04-13 18:30:58 +02:00
verifyexceptionthrown tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
warnings Doc: fix link to QTest::failOnWarning 2023-03-05 06:00:39 +01:00
watchdog QTest: add qSleep(std::chrono::milliseconds) overload 2023-06-30 02:24:53 +03:00
.gitignore
CATCH_LICENSE.txt
CMakeLists.txt CMake: Make qtbase tests standalone projects 2023-07-05 15:09:32 +02:00
README
catch.cpp
catch_p.h
catch_p_p.h Update Catch2 to v2.13.10 2022-10-17 14:07:43 +02:00
expected_assert.junitxml
expected_assert.lightxml
expected_assert.tap
expected_assert.teamcity
expected_assert.txt
expected_assert.xml
expected_badxml.junitxml
expected_badxml.lightxml
expected_badxml.xml
expected_benchlibcallgrind_0.txt
expected_benchlibcallgrind_1.txt
expected_benchlibcallgrind_2.txt
expected_benchlibcounting.csv
expected_benchlibcounting.junitxml
expected_benchlibcounting.lightxml
expected_benchlibcounting.tap
expected_benchlibcounting.txt
expected_benchlibcounting.xml
expected_benchlibeventcounter.csv
expected_benchlibeventcounter.junitxml
expected_benchlibeventcounter.lightxml
expected_benchlibeventcounter.tap
expected_benchlibeventcounter.txt
expected_benchlibeventcounter.xml
expected_benchliboptions.txt
expected_benchlibtickcounter.csv
expected_benchlibtickcounter.junitxml
expected_benchlibtickcounter.lightxml
expected_benchlibtickcounter.tap
expected_benchlibtickcounter.txt
expected_benchlibtickcounter.xml
expected_benchlibwalltime.csv
expected_benchlibwalltime.junitxml
expected_benchlibwalltime.lightxml
expected_benchlibwalltime.tap
expected_benchlibwalltime.txt
expected_benchlibwalltime.xml
expected_blacklisted.junitxml
expected_blacklisted.lightxml
expected_blacklisted.tap
expected_blacklisted.teamcity
expected_blacklisted.txt
expected_blacklisted.xml
expected_cmptest.junitxml QCOMPARE: restore compatibility with braced-init-lists 2023-07-07 12:20:50 +02:00
expected_cmptest.lightxml QCOMPARE: restore compatibility with braced-init-lists 2023-07-07 12:20:50 +02:00
expected_cmptest.tap QCOMPARE: restore compatibility with braced-init-lists 2023-07-07 12:20:50 +02:00
expected_cmptest.teamcity QCOMPARE: restore compatibility with braced-init-lists 2023-07-07 12:20:50 +02:00
expected_cmptest.txt QCOMPARE: restore compatibility with braced-init-lists 2023-07-07 12:20:50 +02:00
expected_cmptest.xml QCOMPARE: restore compatibility with braced-init-lists 2023-07-07 12:20:50 +02:00
expected_commandlinedata.junitxml
expected_commandlinedata.lightxml
expected_commandlinedata.tap
expected_commandlinedata.teamcity
expected_commandlinedata.txt
expected_commandlinedata.xml
expected_counting.junitxml
expected_counting.lightxml
expected_counting.tap
expected_counting.teamcity
expected_counting.txt
expected_counting.xml
expected_crashes_1.txt
expected_crashes_2.txt
expected_datatable.junitxml
expected_datatable.lightxml
expected_datatable.tap
expected_datatable.teamcity
expected_datatable.txt
expected_datatable.xml
expected_datetime.junitxml
expected_datetime.lightxml
expected_datetime.tap
expected_datetime.teamcity
expected_datetime.txt
expected_datetime.xml
expected_deleteLater.junitxml
expected_deleteLater.lightxml
expected_deleteLater.tap
expected_deleteLater.teamcity
expected_deleteLater.txt
expected_deleteLater.xml
expected_deleteLater_noApp.junitxml
expected_deleteLater_noApp.lightxml
expected_deleteLater_noApp.tap
expected_deleteLater_noApp.teamcity
expected_deleteLater_noApp.txt
expected_deleteLater_noApp.xml
expected_differentexec.txt
expected_eventloop.junitxml Skip early return from test loops during cleanup() 2022-09-22 17:34:51 +02:00
expected_eventloop.lightxml Skip early return from test loops during cleanup() 2022-09-22 17:34:51 +02:00
expected_eventloop.tap Skip early return from test loops during cleanup() 2022-09-22 17:34:51 +02:00
expected_eventloop.teamcity Skip early return from test loops during cleanup() 2022-09-22 17:34:51 +02:00
expected_eventloop.txt Skip early return from test loops during cleanup() 2022-09-22 17:34:51 +02:00
expected_eventloop.xml Skip early return from test loops during cleanup() 2022-09-22 17:34:51 +02:00
expected_exceptionthrow.junitxml
expected_exceptionthrow.lightxml
expected_exceptionthrow.tap
expected_exceptionthrow.teamcity
expected_exceptionthrow.txt
expected_exceptionthrow.xml
expected_expectfail.junitxml
expected_expectfail.lightxml
expected_expectfail.tap
expected_expectfail.teamcity
expected_expectfail.txt
expected_expectfail.xml
expected_extendedcompare.junitxml QTest: Rename QCOMPARE_XX parameters to add meaning 2023-03-08 15:10:21 +01:00
expected_extendedcompare.lightxml QTest: Rename QCOMPARE_XX parameters to add meaning 2023-03-08 15:10:21 +01:00
expected_extendedcompare.tap QTest: Rename QCOMPARE_XX parameters to add meaning 2023-03-08 15:10:21 +01:00
expected_extendedcompare.teamcity QTest: Rename QCOMPARE_XX parameters to add meaning 2023-03-08 15:10:21 +01:00
expected_extendedcompare.txt QTest: Rename QCOMPARE_XX parameters to add meaning 2023-03-08 15:10:21 +01:00
expected_extendedcompare.xml QTest: Rename QCOMPARE_XX parameters to add meaning 2023-03-08 15:10:21 +01:00
expected_failcleanup.junitxml Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_failcleanup.lightxml Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_failcleanup.tap Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_failcleanup.teamcity Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_failcleanup.txt Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_failcleanup.xml Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_failcleanuptestcase.junitxml Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_failcleanuptestcase.lightxml Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_failcleanuptestcase.tap Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_failcleanuptestcase.teamcity Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_failcleanuptestcase.txt Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_failcleanuptestcase.xml Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_faildatatype.junitxml
expected_faildatatype.lightxml
expected_faildatatype.tap
expected_faildatatype.teamcity
expected_faildatatype.txt
expected_faildatatype.xml
expected_failfetchtype.junitxml
expected_failfetchtype.lightxml
expected_failfetchtype.tap
expected_failfetchtype.teamcity
expected_failfetchtype.txt
expected_failfetchtype.xml
expected_failinit.junitxml
expected_failinit.lightxml
expected_failinit.tap
expected_failinit.teamcity
expected_failinit.txt
expected_failinit.xml
expected_failinitdata.junitxml
expected_failinitdata.lightxml
expected_failinitdata.tap
expected_failinitdata.teamcity
expected_failinitdata.txt
expected_failinitdata.xml
expected_fetchbogus.junitxml
expected_fetchbogus.lightxml
expected_fetchbogus.tap
expected_fetchbogus.teamcity
expected_fetchbogus.txt
expected_fetchbogus.xml
expected_findtestdata.junitxml
expected_findtestdata.lightxml
expected_findtestdata.tap
expected_findtestdata.teamcity
expected_findtestdata.txt
expected_findtestdata.xml
expected_float.txt
expected_globaldata.junitxml
expected_globaldata.lightxml
expected_globaldata.tap
expected_globaldata.teamcity Include global data tags in teamcity's test function names 2022-09-13 14:51:00 +02:00
expected_globaldata.txt
expected_globaldata.xml
expected_junit.junitxml
expected_keyboard.junitxml
expected_keyboard.lightxml
expected_keyboard.tap
expected_keyboard.teamcity
expected_keyboard.txt
expected_keyboard.xml
expected_longstring.junitxml
expected_longstring.lightxml
expected_longstring.tap
expected_longstring.teamcity
expected_longstring.txt
expected_longstring.xml
expected_maxwarnings.junitxml
expected_maxwarnings.lightxml
expected_maxwarnings.tap
expected_maxwarnings.teamcity
expected_maxwarnings.txt
expected_maxwarnings.xml
expected_mouse.junitxml testlib: make it possible to test double-clicks with discrete events 2022-10-16 08:36:03 +02:00
expected_mouse.lightxml testlib: make it possible to test double-clicks with discrete events 2022-10-16 08:36:03 +02:00
expected_mouse.tap testlib: make it possible to test double-clicks with discrete events 2022-10-16 08:36:03 +02:00
expected_mouse.teamcity testlib: make it possible to test double-clicks with discrete events 2022-10-16 08:36:03 +02:00
expected_mouse.txt testlib: make it possible to test double-clicks with discrete events 2022-10-16 08:36:03 +02:00
expected_mouse.xml testlib: make it possible to test double-clicks with discrete events 2022-10-16 08:36:03 +02:00
expected_multiexec.txt
expected_pairdiagnostics.junitxml
expected_pairdiagnostics.lightxml
expected_pairdiagnostics.tap
expected_pairdiagnostics.teamcity
expected_pairdiagnostics.txt
expected_pairdiagnostics.xml
expected_pass.junitxml
expected_pass.lightxml
expected_pass.tap
expected_pass.teamcity
expected_pass.txt
expected_pass.xml
expected_printdatatags.txt
expected_printdatatagswithglobaltags.txt
expected_qexecstringlist.txt
expected_signaldumper.junitxml
expected_signaldumper.lightxml
expected_signaldumper.tap
expected_signaldumper.teamcity
expected_signaldumper.txt
expected_signaldumper.xml
expected_silent.txt
expected_singleskip.junitxml
expected_singleskip.lightxml
expected_singleskip.tap
expected_singleskip.teamcity
expected_singleskip.txt
expected_singleskip.xml
expected_skip.junitxml
expected_skip.lightxml
expected_skip.tap
expected_skip.teamcity
expected_skip.txt
expected_skip.xml
expected_skipcleanup.junitxml Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_skipcleanup.lightxml Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_skipcleanup.tap Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_skipcleanup.teamcity Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_skipcleanup.txt Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_skipcleanup.xml Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_skipcleanuptestcase.junitxml Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_skipcleanuptestcase.lightxml Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_skipcleanuptestcase.tap Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_skipcleanuptestcase.teamcity Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_skipcleanuptestcase.txt Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_skipcleanuptestcase.xml Test skip and fail in cleanup() as well as in cleanupTestCase() 2022-07-25 19:29:07 +02:00
expected_skipinit.junitxml
expected_skipinit.lightxml
expected_skipinit.tap
expected_skipinit.teamcity
expected_skipinit.txt
expected_skipinit.xml
expected_skipinitdata.junitxml
expected_skipinitdata.lightxml
expected_skipinitdata.tap
expected_skipinitdata.teamcity
expected_skipinitdata.txt
expected_skipinitdata.xml
expected_sleep.txt
expected_strcmp.junitxml
expected_strcmp.lightxml
expected_strcmp.tap
expected_strcmp.teamcity
expected_strcmp.txt
expected_strcmp.xml
expected_subtest.junitxml
expected_subtest.lightxml
expected_subtest.tap
expected_subtest.teamcity
expected_subtest.txt
expected_subtest.xml
expected_testlib.junitxml Use debug stream in QTest::toString's default fallback if possible 2022-07-13 15:14:35 +02:00
expected_testlib.lightxml Use debug stream in QTest::toString's default fallback if possible 2022-07-13 15:14:35 +02:00
expected_testlib.tap Use debug stream in QTest::toString's default fallback if possible 2022-07-13 15:14:35 +02:00
expected_testlib.teamcity Use debug stream in QTest::toString's default fallback if possible 2022-07-13 15:14:35 +02:00
expected_testlib.txt Use debug stream in QTest::toString's default fallback if possible 2022-07-13 15:14:35 +02:00
expected_testlib.xml Use debug stream in QTest::toString's default fallback if possible 2022-07-13 15:14:35 +02:00
expected_tuplediagnostics.junitxml
expected_tuplediagnostics.lightxml
expected_tuplediagnostics.tap
expected_tuplediagnostics.teamcity
expected_tuplediagnostics.txt
expected_tuplediagnostics.xml
expected_verbose1.junitxml
expected_verbose1.lightxml
expected_verbose1.tap
expected_verbose1.teamcity
expected_verbose1.txt
expected_verbose1.xml
expected_verbose2.junitxml
expected_verbose2.lightxml
expected_verbose2.tap
expected_verbose2.teamcity
expected_verbose2.txt
expected_verbose2.xml
expected_verifyexceptionthrown.junitxml
expected_verifyexceptionthrown.lightxml
expected_verifyexceptionthrown.tap
expected_verifyexceptionthrown.teamcity
expected_verifyexceptionthrown.txt
expected_verifyexceptionthrown.xml
expected_warnings.junitxml
expected_warnings.lightxml
expected_warnings.tap
expected_warnings.teamcity
expected_warnings.txt
expected_warnings.xml
expected_watchdog.junitxml
expected_watchdog.lightxml
expected_watchdog.tap
expected_watchdog.teamcity
expected_watchdog.txt
expected_watchdog.xml
generate_expected_output.py Add some testing of QTestEventLoop 2022-08-08 20:49:03 +02:00
qt_attribution.json Update Catch2 to v2.13.10 2022-10-17 14:07:43 +02:00
tst_selftests.cpp Use QString/QByteArray range erase() 2022-12-07 15:03:03 +02:00

README

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Running the QtTestLib selftests with Catch2
===========================================

Catch2 [1] is a header only test framework that we use to allow
testing QtTestLib without relying on any part of testlib itself.

To run the test suite, execute 'make check' or './tst_selftests'
as normal. This should print:

    ===================================================================
    All tests passed (2453 assertions in 5 test cases)

To run specific tests, first lists the available tests:

     ./tst_selftests -l
    All available test cases:
      Loggers support both old and new style arguments
      Loggers can output to both file and stdout
      Logging to file and stdout at the same time
      All loggers can be enabled at the same time
      Scenario: Test output of the loggers is as expected
    5 test cases

Then pass the name of the test in quotes as the first argument:

     ./tst_selftests "Loggers support both old and new style arguments"
    Filters: Loggers support both old and new style arguments
    ==================================================================
    All tests passed (96 assertions in 1 test case)

You can find the tests in the sources as individual TEST_CASE
entries. Note that each of these tests run the tests once per
logger, and in the case of the test log check also all sub tests,
so the amount of actual test assertions is much higher than the
five tests listed above.

To see what the tests is actually doing, pass the -s option.
This will result in very verbose output. Each leaf test is
prefixed with a heading:

    ---------------------------------------------------------------
          Given: The QTestLog::TAP logger
           When: Passing arguments with new style
    ---------------------------------------------------------------

You can choose a specific subtest by passing the -c option:

     ./tst_selftests "Scenario: Test output of the loggers is as expected" \
        -c "Given: The QTestLog::Plain logger" \
        -c 'And given: The "skip" subtest'

It's possible to pass only the first -c options, to e.g. run all
tests with the Plain logger, but it's unfortunately not possible
to pass only the last -c option, to run the 'skip' subtest with
all loggers.

If a test fails it will print the expected, actual, and difference.
The test results are also left in a temporary directory for closer
inspection.

Add new tests by modifying selftest.pri and CMakeLists.txt, adding
a new subprogram.

Generating new test expectations is done using the python script
in this directory (generate_expected_output.py). In the future this
will be done with the --rebase option to ./tst_selftest, but this
is not fleshed out yet.

[1] https://github.com/catchorg/Catch2