Add test for multiple streaming parts in UNSCOPED_INFO

This commit is contained in:
Martin Hořeňovský 2023-09-17 10:44:31 +02:00
parent 92672591c1
commit 9c541ca72e
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
18 changed files with 139 additions and 18 deletions

View File

@ -162,6 +162,7 @@ Nor would this
:test-result: PASS Hashers with same seed produce same hash
:test-result: PASS Hashing different test cases produces different result
:test-result: PASS Hashing test case produces same hash across multiple calls
:test-result: FAIL INFO and UNSCOPED_INFO can stream multiple arguments
:test-result: FAIL INFO and WARN do not abort tests
:test-result: FAIL INFO gets logged on failure
:test-result: FAIL INFO gets logged on failure, even if captured before successful assertions

View File

@ -160,6 +160,7 @@
:test-result: PASS Hashers with same seed produce same hash
:test-result: PASS Hashing different test cases produces different result
:test-result: PASS Hashing test case produces same hash across multiple calls
:test-result: FAIL INFO and UNSCOPED_INFO can stream multiple arguments
:test-result: FAIL INFO and WARN do not abort tests
:test-result: FAIL INFO gets logged on failure
:test-result: FAIL INFO gets logged on failure, even if captured before successful assertions

View File

@ -944,6 +944,7 @@ TestCaseInfoHasher.tests.cpp:<line number>: passed: h( dummy1 ) != h( dummy2 ) f
TestCaseInfoHasher.tests.cpp:<line number>: passed: h( dummy ) == h( dummy ) for: 3422778688 (0x<hex digits>)
==
3422778688 (0x<hex digits>)
Message.tests.cpp:<line number>: failed: explicitly with 3 messages: 'This info has multiple parts.' and 'This unscoped info has multiple parts.' and 'Show infos!'
Message.tests.cpp:<line number>: warning: 'this is a message' with 1 message: 'this is a warning'
Message.tests.cpp:<line number>: failed: a == 1 for: 2 == 1 with 2 messages: 'this message should be logged' and 'so should this'
Message.tests.cpp:<line number>: passed: a == 2 for: 2 == 2 with 1 message: 'this message may be logged later'
@ -2543,7 +2544,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed:
test cases: 412 | 308 passed | 84 failed | 6 skipped | 14 failed as expected
assertions: 2229 | 2049 passed | 145 failed | 35 failed as expected
test cases: 413 | 308 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2230 | 2049 passed | 146 failed | 35 failed as expected

View File

@ -942,6 +942,7 @@ TestCaseInfoHasher.tests.cpp:<line number>: passed: h( dummy1 ) != h( dummy2 ) f
TestCaseInfoHasher.tests.cpp:<line number>: passed: h( dummy ) == h( dummy ) for: 3422778688 (0x<hex digits>)
==
3422778688 (0x<hex digits>)
Message.tests.cpp:<line number>: failed: explicitly with 3 messages: 'This info has multiple parts.' and 'This unscoped info has multiple parts.' and 'Show infos!'
Message.tests.cpp:<line number>: warning: 'this is a message' with 1 message: 'this is a warning'
Message.tests.cpp:<line number>: failed: a == 1 for: 2 == 1 with 2 messages: 'this message should be logged' and 'so should this'
Message.tests.cpp:<line number>: passed: a == 2 for: 2 == 2 with 1 message: 'this message may be logged later'
@ -2532,7 +2533,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed:
test cases: 412 | 308 passed | 84 failed | 6 skipped | 14 failed as expected
assertions: 2229 | 2049 passed | 145 failed | 35 failed as expected
test cases: 413 | 308 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2230 | 2049 passed | 146 failed | 35 failed as expected

View File

@ -599,6 +599,18 @@ explicitly with message:
Message.tests.cpp:<line number>: warning:
This message appears in the output
-------------------------------------------------------------------------------
INFO and UNSCOPED_INFO can stream multiple arguments
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
explicitly with messages:
This info has multiple parts.
This unscoped info has multiple parts.
Show infos!
-------------------------------------------------------------------------------
INFO and WARN do not abort tests
-------------------------------------------------------------------------------
@ -1576,6 +1588,6 @@ due to unexpected exception with message:
Why would you throw a std::string?
===============================================================================
test cases: 412 | 322 passed | 69 failed | 7 skipped | 14 failed as expected
assertions: 2212 | 2049 passed | 128 failed | 35 failed as expected
test cases: 413 | 322 passed | 70 failed | 7 skipped | 14 failed as expected
assertions: 2213 | 2049 passed | 129 failed | 35 failed as expected

View File

@ -6982,6 +6982,18 @@ with expansion:
==
3422778688 (0x<hex digits>)
-------------------------------------------------------------------------------
INFO and UNSCOPED_INFO can stream multiple arguments
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
explicitly with messages:
This info has multiple parts.
This unscoped info has multiple parts.
Show infos!
-------------------------------------------------------------------------------
INFO and WARN do not abort tests
-------------------------------------------------------------------------------
@ -18271,6 +18283,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 412 | 308 passed | 84 failed | 6 skipped | 14 failed as expected
assertions: 2229 | 2049 passed | 145 failed | 35 failed as expected
test cases: 413 | 308 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2230 | 2049 passed | 146 failed | 35 failed as expected

View File

@ -6980,6 +6980,18 @@ with expansion:
==
3422778688 (0x<hex digits>)
-------------------------------------------------------------------------------
INFO and UNSCOPED_INFO can stream multiple arguments
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
explicitly with messages:
This info has multiple parts.
This unscoped info has multiple parts.
Show infos!
-------------------------------------------------------------------------------
INFO and WARN do not abort tests
-------------------------------------------------------------------------------
@ -18260,6 +18272,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 412 | 308 passed | 84 failed | 6 skipped | 14 failed as expected
assertions: 2229 | 2049 passed | 145 failed | 35 failed as expected
test cases: 413 | 308 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2230 | 2049 passed | 146 failed | 35 failed as expected

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact
>
<testsuite name="<exe-name>" errors="17" failures="128" skipped="12" tests="2241" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2242" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>
@ -752,6 +752,15 @@ at Message.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Hashing different test cases produces different result/Different classname" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Hashing different test cases produces different result/Different tags" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Hashing test case produces same hash across multiple calls" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="INFO and UNSCOPED_INFO can stream multiple arguments" time="{duration}" status="run">
<failure type="FAIL">
FAILED:
Show infos!
This info has multiple parts.
This unscoped info has multiple parts.
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="INFO and WARN do not abort tests" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="INFO gets logged on failure" time="{duration}" status="run">
<failure message="a == 1" type="REQUIRE">

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="<exe-name>" errors="17" failures="128" skipped="12" tests="2241" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2242" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>
@ -751,6 +751,15 @@ at Message.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Hashing different test cases produces different result/Different classname" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Hashing different test cases produces different result/Different tags" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Hashing test case produces same hash across multiple calls" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="INFO and UNSCOPED_INFO can stream multiple arguments" time="{duration}" status="run">
<failure type="FAIL">
FAILED:
Show infos!
This info has multiple parts.
This unscoped info has multiple parts.
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="INFO and WARN do not abort tests" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="INFO gets logged on failure" time="{duration}" status="run">
<failure message="a == 1" type="REQUIRE">

View File

@ -1477,6 +1477,15 @@ at Message.tests.cpp:<line number>
<failure message="FAIL_CHECK()">
FAILED:
This is a failure
at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="INFO and UNSCOPED_INFO can stream multiple arguments" duration="{duration}">
<failure message="FAIL()">
FAILED:
Show infos!
This info has multiple parts.
This unscoped info has multiple parts.
at Message.tests.cpp:<line number>
</failure>
</testCase>

View File

@ -1476,6 +1476,15 @@ at Message.tests.cpp:<line number>
<failure message="FAIL_CHECK()">
FAILED:
This is a failure
at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="INFO and UNSCOPED_INFO can stream multiple arguments" duration="{duration}">
<failure message="FAIL()">
FAILED:
Show infos!
This info has multiple parts.
This unscoped info has multiple parts.
at Message.tests.cpp:<line number>
</failure>
</testCase>

View File

@ -1796,6 +1796,8 @@ ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2673152918 (0x<hex digits>) !
ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2074929312 (0x<hex digits>) != 3429949824 (0x<hex digits>)
# Hashing test case produces same hash across multiple calls
ok {test-number} - h( dummy ) == h( dummy ) for: 3422778688 (0x<hex digits>) == 3422778688 (0x<hex digits>)
# INFO and UNSCOPED_INFO can stream multiple arguments
not ok {test-number} - explicitly with 3 messages: 'This info has multiple parts.' and 'This unscoped info has multiple parts.' and 'Show infos!'
# INFO and WARN do not abort tests
warning {test-number} - 'this is a message' with 1 message: 'this is a warning'
# INFO gets logged on failure
@ -4487,5 +4489,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
1..2241
1..2242

View File

@ -1794,6 +1794,8 @@ ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2673152918 (0x<hex digits>) !
ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2074929312 (0x<hex digits>) != 3429949824 (0x<hex digits>)
# Hashing test case produces same hash across multiple calls
ok {test-number} - h( dummy ) == h( dummy ) for: 3422778688 (0x<hex digits>) == 3422778688 (0x<hex digits>)
# INFO and UNSCOPED_INFO can stream multiple arguments
not ok {test-number} - explicitly with 3 messages: 'This info has multiple parts.' and 'This unscoped info has multiple parts.' and 'Show infos!'
# INFO and WARN do not abort tests
warning {test-number} - 'this is a message' with 1 message: 'this is a warning'
# INFO gets logged on failure
@ -4476,5 +4478,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
1..2241
1..2242

View File

@ -393,6 +393,9 @@
##teamcity[testFinished name='Hashing different test cases produces different result' duration="{duration}"]
##teamcity[testStarted name='Hashing test case produces same hash across multiple calls']
##teamcity[testFinished name='Hashing test case produces same hash across multiple calls' duration="{duration}"]
##teamcity[testStarted name='INFO and UNSCOPED_INFO can stream multiple arguments']
##teamcity[testFailed name='INFO and UNSCOPED_INFO can stream multiple arguments' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with messages:|n "This info has multiple parts."|n "This unscoped info has multiple parts."|n "Show infos!"']
##teamcity[testFinished name='INFO and UNSCOPED_INFO can stream multiple arguments' duration="{duration}"]
##teamcity[testStarted name='INFO and WARN do not abort tests']
##teamcity[testFinished name='INFO and WARN do not abort tests' duration="{duration}"]
##teamcity[testStarted name='INFO gets logged on failure']

View File

@ -393,6 +393,9 @@
##teamcity[testFinished name='Hashing different test cases produces different result' duration="{duration}"]
##teamcity[testStarted name='Hashing test case produces same hash across multiple calls']
##teamcity[testFinished name='Hashing test case produces same hash across multiple calls' duration="{duration}"]
##teamcity[testStarted name='INFO and UNSCOPED_INFO can stream multiple arguments']
##teamcity[testFailed name='INFO and UNSCOPED_INFO can stream multiple arguments' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with messages:|n "This info has multiple parts."|n "This unscoped info has multiple parts."|n "Show infos!"']
##teamcity[testFinished name='INFO and UNSCOPED_INFO can stream multiple arguments' duration="{duration}"]
##teamcity[testStarted name='INFO and WARN do not abort tests']
##teamcity[testFinished name='INFO and WARN do not abort tests' duration="{duration}"]
##teamcity[testStarted name='INFO gets logged on failure']

View File

@ -8371,6 +8371,18 @@ C
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="INFO and UNSCOPED_INFO can stream multiple arguments" tags="[.][failing][info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
This info has multiple parts.
</Info>
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
This unscoped info has multiple parts.
</Info>
<Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
Show infos!
</Failure>
<OverallResult success="false" skips="0"/>
</TestCase>
<TestCase name="INFO and WARN do not abort tests" tags="[.][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
this is a message
@ -21256,6 +21268,6 @@ b1!
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<OverallResults successes="2049" failures="145" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="308" failures="84" expectedFailures="14" skips="6"/>
<OverallResults successes="2049" failures="146" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="308" failures="85" expectedFailures="14" skips="6"/>
</Catch2TestRun>

View File

@ -8371,6 +8371,18 @@ C
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="INFO and UNSCOPED_INFO can stream multiple arguments" tags="[.][failing][info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
This info has multiple parts.
</Info>
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
This unscoped info has multiple parts.
</Info>
<Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
Show infos!
</Failure>
<OverallResult success="false" skips="0"/>
</TestCase>
<TestCase name="INFO and WARN do not abort tests" tags="[.][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
this is a message
@ -21255,6 +21267,6 @@ b1!
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<OverallResults successes="2049" failures="145" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="308" failures="84" expectedFailures="14" skips="6"/>
<OverallResults successes="2049" failures="146" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="308" failures="85" expectedFailures="14" skips="6"/>
</Catch2TestRun>

View File

@ -285,3 +285,14 @@ TEST_CASE("CAPTURE parses string and character constants", "[messages][capture]"
#ifdef _MSC_VER
#pragma warning(pop)
#endif
TEST_CASE( "INFO and UNSCOPED_INFO can stream multiple arguments",
"[messages][info][.failing]" ) {
INFO( "This info"
<< " has multiple"
<< " parts." );
UNSCOPED_INFO( "This unscoped info"
<< " has multiple"
<< " parts." );
FAIL( "Show infos!" );
}