From 9c541ca72e7857dec71d8a41b97e42c2f1c92602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 17 Sep 2023 10:44:31 +0200 Subject: [PATCH] Add test for multiple streaming parts in UNSCOPED_INFO --- .../SelfTest/Baselines/automake.sw.approved.txt | 1 + .../Baselines/automake.sw.multi.approved.txt | 1 + tests/SelfTest/Baselines/compact.sw.approved.txt | 5 +++-- .../Baselines/compact.sw.multi.approved.txt | 5 +++-- .../SelfTest/Baselines/console.std.approved.txt | 16 ++++++++++++++-- tests/SelfTest/Baselines/console.sw.approved.txt | 16 ++++++++++++++-- .../Baselines/console.sw.multi.approved.txt | 16 ++++++++++++++-- tests/SelfTest/Baselines/junit.sw.approved.txt | 11 ++++++++++- .../Baselines/junit.sw.multi.approved.txt | 11 ++++++++++- .../SelfTest/Baselines/sonarqube.sw.approved.txt | 9 +++++++++ .../Baselines/sonarqube.sw.multi.approved.txt | 9 +++++++++ tests/SelfTest/Baselines/tap.sw.approved.txt | 4 +++- .../SelfTest/Baselines/tap.sw.multi.approved.txt | 4 +++- .../SelfTest/Baselines/teamcity.sw.approved.txt | 3 +++ .../Baselines/teamcity.sw.multi.approved.txt | 3 +++ tests/SelfTest/Baselines/xml.sw.approved.txt | 16 ++++++++++++++-- .../SelfTest/Baselines/xml.sw.multi.approved.txt | 16 ++++++++++++++-- tests/SelfTest/UsageTests/Message.tests.cpp | 11 +++++++++++ 18 files changed, 139 insertions(+), 18 deletions(-) diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt index cfddf217..6748c0ec 100644 --- a/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -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 diff --git a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt index 80ed1325..a8bdcfa1 100644 --- a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt @@ -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 diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index cac5fc03..0873d5f2 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -944,6 +944,7 @@ TestCaseInfoHasher.tests.cpp:: passed: h( dummy1 ) != h( dummy2 ) f TestCaseInfoHasher.tests.cpp:: passed: h( dummy ) == h( dummy ) for: 3422778688 (0x) == 3422778688 (0x) +Message.tests.cpp:: failed: explicitly with 3 messages: 'This info has multiple parts.' and 'This unscoped info has multiple parts.' and 'Show infos!' Message.tests.cpp:: warning: 'this is a message' with 1 message: 'this is a warning' Message.tests.cpp:: failed: a == 1 for: 2 == 1 with 2 messages: 'this message should be logged' and 'so should this' Message.tests.cpp:: passed: a == 2 for: 2 == 2 with 1 message: 'this message may be logged later' @@ -2543,7 +2544,7 @@ InternalBenchmark.tests.cpp:: passed: med == 18. for: 18.0 == 18.0 InternalBenchmark.tests.cpp:: passed: q3 == 23. for: 23.0 == 23.0 Misc.tests.cpp:: passed: Misc.tests.cpp:: 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 diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index e3e3fe25..2484ed18 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -942,6 +942,7 @@ TestCaseInfoHasher.tests.cpp:: passed: h( dummy1 ) != h( dummy2 ) f TestCaseInfoHasher.tests.cpp:: passed: h( dummy ) == h( dummy ) for: 3422778688 (0x) == 3422778688 (0x) +Message.tests.cpp:: failed: explicitly with 3 messages: 'This info has multiple parts.' and 'This unscoped info has multiple parts.' and 'Show infos!' Message.tests.cpp:: warning: 'this is a message' with 1 message: 'this is a warning' Message.tests.cpp:: failed: a == 1 for: 2 == 1 with 2 messages: 'this message should be logged' and 'so should this' Message.tests.cpp:: passed: a == 2 for: 2 == 2 with 1 message: 'this message may be logged later' @@ -2532,7 +2533,7 @@ InternalBenchmark.tests.cpp:: passed: med == 18. for: 18.0 == 18.0 InternalBenchmark.tests.cpp:: passed: q3 == 23. for: 23.0 == 23.0 Misc.tests.cpp:: passed: Misc.tests.cpp:: 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 diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index 52a1b3a9..4ad25ed8 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -599,6 +599,18 @@ explicitly with message: Message.tests.cpp:: warning: This message appears in the output +------------------------------------------------------------------------------- +INFO and UNSCOPED_INFO can stream multiple arguments +------------------------------------------------------------------------------- +Message.tests.cpp: +............................................................................... + +Message.tests.cpp:: 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 diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 80317f5b..bb8d09ac 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -6982,6 +6982,18 @@ with expansion: == 3422778688 (0x) +------------------------------------------------------------------------------- +INFO and UNSCOPED_INFO can stream multiple arguments +------------------------------------------------------------------------------- +Message.tests.cpp: +............................................................................... + +Message.tests.cpp:: 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: Misc.tests.cpp:: 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 diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index fb55a0c4..ce06a690 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -6980,6 +6980,18 @@ with expansion: == 3422778688 (0x) +------------------------------------------------------------------------------- +INFO and UNSCOPED_INFO can stream multiple arguments +------------------------------------------------------------------------------- +Message.tests.cpp: +............................................................................... + +Message.tests.cpp:: 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: Misc.tests.cpp:: 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 diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index 7fb79463..3b6c8fa0 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -752,6 +752,15 @@ at Message.tests.cpp: + + +FAILED: +Show infos! +This info has multiple parts. +This unscoped info has multiple parts. +at Message.tests.cpp: + + diff --git a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt index 4fee867f..48b8acc8 100644 --- a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt @@ -1,6 +1,6 @@ - + @@ -751,6 +751,15 @@ at Message.tests.cpp: + + +FAILED: +Show infos! +This info has multiple parts. +This unscoped info has multiple parts. +at Message.tests.cpp: + + diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index 6cbb7c7b..b634d27e 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -1477,6 +1477,15 @@ at Message.tests.cpp: FAILED: This is a failure +at Message.tests.cpp: + + + + +FAILED: +Show infos! +This info has multiple parts. +This unscoped info has multiple parts. at Message.tests.cpp: diff --git a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt index ba9504cb..33c9c208 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -1476,6 +1476,15 @@ at Message.tests.cpp: FAILED: This is a failure +at Message.tests.cpp: + + + + +FAILED: +Show infos! +This info has multiple parts. +This unscoped info has multiple parts. at Message.tests.cpp: diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index 59bd2054..2b2b6eba 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -1796,6 +1796,8 @@ ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2673152918 (0x) ! ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2074929312 (0x) != 3429949824 (0x) # Hashing test case produces same hash across multiple calls ok {test-number} - h( dummy ) == h( dummy ) for: 3422778688 (0x) == 3422778688 (0x) +# 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 diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index 3b1a4d85..13240e52 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -1794,6 +1794,8 @@ ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2673152918 (0x) ! ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2074929312 (0x) != 3429949824 (0x) # Hashing test case produces same hash across multiple calls ok {test-number} - h( dummy ) == h( dummy ) for: 3422778688 (0x) == 3422778688 (0x) +# 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 diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index 1f215c1e..4293464d 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -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:|n...............................................................................|n|nMessage.tests.cpp:|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'] diff --git a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt index 1f557c8f..b68d8bdb 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt @@ -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:|n...............................................................................|n|nMessage.tests.cpp:|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'] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 7f4e8d3a..89ce930e 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -8371,6 +8371,18 @@ C + + + This info has multiple parts. + + + This unscoped info has multiple parts. + + + Show infos! + + + this is a message @@ -21256,6 +21268,6 @@ b1! - - + + diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index 53afdef4..070db9f9 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -8371,6 +8371,18 @@ C + + + This info has multiple parts. + + + This unscoped info has multiple parts. + + + Show infos! + + + this is a message @@ -21255,6 +21267,6 @@ b1! - - + + diff --git a/tests/SelfTest/UsageTests/Message.tests.cpp b/tests/SelfTest/UsageTests/Message.tests.cpp index a5e69582..419c5372 100644 --- a/tests/SelfTest/UsageTests/Message.tests.cpp +++ b/tests/SelfTest/UsageTests/Message.tests.cpp @@ -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!" ); +}