Regularize scoped message lifetime to only consider the object's scope

This means that:
1) Scoped messages are always removed at the end of their scope,
   even if the scope ended due to an exception.
2) Scoped messages outlive section end, if that section's scope is
   enclosed in their own.

Previously neither of these were true, which has led to a number
of surprising behaviour, where e.g. this:
```cpp
TEST_CASE() {
    try {
        INFO( "some info" );
        throw std::runtime_error( "ex" );
    } catch (std::exception const&) {}

    REQUIRE( false );
}
```
would print "some info" as the message for the assertion, while this:
```cpp
TEST_CASE() {
    INFO("Hello");
    SECTION("dummy") {}
    REQUIRE(false);
}
```
would not print out "Hello" as the message for the assertion.

This had an underlying reason, in that it was trying to helpfully
keep the messages around in case of unexpected exceptions, so that
code like this:
```cpp
TEST_CASE() {
    auto [input, expected] = GENERATE(...);
    CAPTURE(input);
    auto result = transform(input); // throws
    REQUIRE(result == expected);
}
```
would report the value of `input` when `transform` throws. However,
it was surprising in practice and was causing various issues around
handling of messages in other cases.

Closes #1759
Closes #2019
Closes #2959
This commit is contained in:
Martin Hořeňovský
2025-07-21 17:47:59 +02:00
parent 98b4bbb35e
commit 10aef62f21
22 changed files with 831 additions and 73 deletions

View File

@@ -1,32 +1,30 @@
<a id="top"></a>
# Logging macros
Additional messages can be logged during a test case. Note that the messages logged with `INFO` are scoped and thus will not be reported if failure occurs in scope preceding the message declaration. An example:
Catch2 provides various macros for logging extra information when
running a test. These macros default to being scoped, and associate with
all assertions in the scope, regardless of whether they pass or fail.
**example**
```cpp
TEST_CASE("Foo") {
TEST_CASE("Simple info") {
INFO("Test case start");
for (int i = 0; i < 2; ++i) {
INFO("The number is " << i);
CHECK(i == 0);
SECTION("A") {
INFO("Section A");
CHECK(false); // 1
}
SECTION("B") {
INFO("Section B");
CHECK(false); // 2
}
CHECK(false); // 3
}
```
The first assertion will report messages "Test case start", and "Section A"
as extra information. The second one will report messages "Test case
started" and "Section B", while the third one will only report "Test case
started" as the extra info.
TEST_CASE("Bar") {
INFO("Test case start");
for (int i = 0; i < 2; ++i) {
INFO("The number is " << i);
CHECK(i == i);
}
CHECK(false);
}
```
When the `CHECK` fails in the "Foo" test case, then two messages will be printed.
```
Test case start
The number is 1
```
When the last `CHECK` fails in the "Bar" test case, then only one message will be printed: `Test case start`.
## Logging without local scope

View File

@@ -7,7 +7,6 @@
// SPDX-License-Identifier: BSL-1.0
#include <catch2/catch_message.hpp>
#include <catch2/interfaces/catch_interfaces_capture.hpp>
#include <catch2/internal/catch_uncaught_exceptions.hpp>
#include <catch2/internal/catch_enforce.hpp>
#include <catch2/internal/catch_move_and_forward.hpp>
@@ -31,7 +30,7 @@ namespace Catch {
}
ScopedMessage::~ScopedMessage() {
if ( !uncaught_exceptions() && !m_moved ){
if ( !m_moved ){
getResultCapture().popScopedMessage(m_info);
}
}
@@ -101,12 +100,10 @@ namespace Catch {
m_messages.back().message += " := ";
}
Capturer::~Capturer() {
if ( !uncaught_exceptions() ){
assert( m_captured == m_messages.size() );
for ( size_t i = 0; i < m_captured; ++i )
m_resultCapture.popScopedMessage( m_messages[i] );
}
}
void Capturer::captureValue( size_t index, std::string const& value ) {
assert( index < m_messages.size() );

View File

@@ -402,9 +402,6 @@ namespace Catch {
endInfo.durationInSeconds,
missingAssertions ) );
}
m_messages.clear();
m_messageScopes.clear();
}
void RunContext::sectionEndedEarly(SectionEndInfo&& endInfo) {
@@ -568,8 +565,10 @@ namespace Catch {
m_testCaseTracker->close();
handleUnfinishedSections();
m_messages.clear();
m_messageScopes.clear();
// TBD: At this point, m_messages should be empty. Do we want to
// assert that this is true, or keep the defensive clear call?
m_messages.clear();
SectionStats testCaseSectionStats(CATCH_MOVE(testCaseSection), assertions, duration, missingAssertions);
m_reporter->sectionEnded(testCaseSectionStats);

View File

@@ -102,6 +102,8 @@ Nor would this
:test-result: PASS CAPTURE can deal with complex expressions involving commas
:test-result: PASS CAPTURE parses string and character constants
:test-result: PASS Capture and info messages
:test-result: FAIL Captures do not leave block with an exception
:test-result: FAIL Captures outlive section end
:test-result: PASS CaseInsensitiveEqualsTo is case insensitive
:test-result: PASS CaseInsensitiveLess is case insensitive
:test-result: PASS Character pretty printing
@@ -226,6 +228,9 @@ Nor would this
:test-result: PASS Scenario: Do that thing with the thing
:test-result: PASS Scenario: This is a really long scenario name to see how the list command deals with wrapping
:test-result: PASS Scenario: Vector resizing affects size and capacity
:test-result: FAIL Scoped message applies to all assertions in scope
:test-result: FAIL Scoped messages do not leave block with an exception
:test-result: FAIL Scoped messages outlive section end
A string sent directly to stdout
A string sent directly to stderr
A string sent to stderr via clog

View File

@@ -100,6 +100,8 @@
:test-result: PASS CAPTURE can deal with complex expressions involving commas
:test-result: PASS CAPTURE parses string and character constants
:test-result: PASS Capture and info messages
:test-result: FAIL Captures do not leave block with an exception
:test-result: FAIL Captures outlive section end
:test-result: PASS CaseInsensitiveEqualsTo is case insensitive
:test-result: PASS CaseInsensitiveLess is case insensitive
:test-result: PASS Character pretty printing
@@ -224,6 +226,9 @@
:test-result: PASS Scenario: Do that thing with the thing
:test-result: PASS Scenario: This is a really long scenario name to see how the list command deals with wrapping
:test-result: PASS Scenario: Vector resizing affects size and capacity
:test-result: FAIL Scoped message applies to all assertions in scope
:test-result: FAIL Scoped messages do not leave block with an exception
:test-result: FAIL Scoped messages outlive section end
:test-result: FAIL Sends stuff to stdout and stderr
:test-result: PASS Some simple comparisons between doubles
:test-result: FAIL Standard output from all sections is reported

View File

@@ -85,7 +85,7 @@ Matchers.tests.cpp:<line number>: passed: smallest_non_zero, !WithinULP( -smalle
Matchers.tests.cpp:<line number>: passed: smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45])
Matchers.tests.cpp:<line number>: passed: smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00])
Generators.tests.cpp:<line number>: failed: unexpected exception with message: 'failure to init'; expression was: {Unknown expression after the reported line}
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: {Unknown expression after the reported line} with 1 message: 'expected exception'
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'expected exception'; expression was: {Unknown expression after the reported line}
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception'
Exception.tests.cpp:<line number>: passed: thisThrows() with 1 message: 'answer := 42'
Compilation.tests.cpp:<line number>: passed: 42 == f for: 42 == {?}
@@ -363,6 +363,9 @@ Message.tests.cpp:<line number>: passed: with 7 messages: 'custom_index_op<int>{
Message.tests.cpp:<line number>: passed: with 11 messages: '("comma, in string", "escaped, \", ") := "escaped, ", "' and '"single quote in string,'," := "single quote in string,',"' and '"some escapes, \\,\\\\" := "some escapes, \,\\"' and '"some, ), unmatched, } prenheses {[<" := "some, ), unmatched, } prenheses {[<"' and ''"' := '"'' and ''\'' := '''' and '',' := ','' and ''}' := '}'' and '')' := ')'' and ''(' := '('' and ''{' := '{''
ToStringGeneral.tests.cpp:<line number>: passed: true with 1 message: 'i := 2'
ToStringGeneral.tests.cpp:<line number>: passed: true with 1 message: '3'
Message.tests.cpp:<line number>: failed: false with 1 message: 'a := 1'
Message.tests.cpp:<line number>: passed: true with 1 message: 'a := 1'
Message.tests.cpp:<line number>: failed: false with 1 message: 'a := 1'
Details.tests.cpp:<line number>: passed: eq( "", "" ) for: true
Details.tests.cpp:<line number>: passed: !(eq( "", "a" )) for: !false
Details.tests.cpp:<line number>: passed: eq( "a", "a" ) for: true
@@ -1732,6 +1735,11 @@ BDD.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
BDD.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0
BDD.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
BDD.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0
Message.tests.cpp:<line number>: failed: false with 1 message: 'This will be reported multiple times'
Message.tests.cpp:<line number>: failed: false with 1 message: 'This will be reported multiple times'
Message.tests.cpp:<line number>: failed: false with 1 message: 'Should be in scope at the end'
Message.tests.cpp:<line number>: passed: true with 1 message: 'Should survive a section end'
Message.tests.cpp:<line number>: failed: false with 1 message: 'Should survive a section end'
A string sent directly to stdout
A string sent directly to stderr
A string sent to stderr via clog
@@ -2854,7 +2862,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: 423 | 313 passed | 90 failed | 6 skipped | 14 failed as expected
assertions: 2273 | 2087 passed | 151 failed | 35 failed as expected
test cases: 428 | 313 passed | 95 failed | 6 skipped | 14 failed as expected
assertions: 2281 | 2089 passed | 157 failed | 35 failed as expected

View File

@@ -83,7 +83,7 @@ Matchers.tests.cpp:<line number>: passed: smallest_non_zero, !WithinULP( -smalle
Matchers.tests.cpp:<line number>: passed: smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45])
Matchers.tests.cpp:<line number>: passed: smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00])
Generators.tests.cpp:<line number>: failed: unexpected exception with message: 'failure to init'; expression was: {Unknown expression after the reported line}
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: {Unknown expression after the reported line} with 1 message: 'expected exception'
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'expected exception'; expression was: {Unknown expression after the reported line}
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception'
Exception.tests.cpp:<line number>: passed: thisThrows() with 1 message: 'answer := 42'
Compilation.tests.cpp:<line number>: passed: 42 == f for: 42 == {?}
@@ -361,6 +361,9 @@ Message.tests.cpp:<line number>: passed: with 7 messages: 'custom_index_op<int>{
Message.tests.cpp:<line number>: passed: with 11 messages: '("comma, in string", "escaped, \", ") := "escaped, ", "' and '"single quote in string,'," := "single quote in string,',"' and '"some escapes, \\,\\\\" := "some escapes, \,\\"' and '"some, ), unmatched, } prenheses {[<" := "some, ), unmatched, } prenheses {[<"' and ''"' := '"'' and ''\'' := '''' and '',' := ','' and ''}' := '}'' and '')' := ')'' and ''(' := '('' and ''{' := '{''
ToStringGeneral.tests.cpp:<line number>: passed: true with 1 message: 'i := 2'
ToStringGeneral.tests.cpp:<line number>: passed: true with 1 message: '3'
Message.tests.cpp:<line number>: failed: false with 1 message: 'a := 1'
Message.tests.cpp:<line number>: passed: true with 1 message: 'a := 1'
Message.tests.cpp:<line number>: failed: false with 1 message: 'a := 1'
Details.tests.cpp:<line number>: passed: eq( "", "" ) for: true
Details.tests.cpp:<line number>: passed: !(eq( "", "a" )) for: !false
Details.tests.cpp:<line number>: passed: eq( "a", "a" ) for: true
@@ -1730,6 +1733,11 @@ BDD.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
BDD.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0
BDD.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
BDD.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0
Message.tests.cpp:<line number>: failed: false with 1 message: 'This will be reported multiple times'
Message.tests.cpp:<line number>: failed: false with 1 message: 'This will be reported multiple times'
Message.tests.cpp:<line number>: failed: false with 1 message: 'Should be in scope at the end'
Message.tests.cpp:<line number>: passed: true with 1 message: 'Should survive a section end'
Message.tests.cpp:<line number>: failed: false with 1 message: 'Should survive a section end'
Approx.tests.cpp:<line number>: passed: d == Approx( 1.23 ) for: 1.22999999999999998
==
Approx( 1.22999999999999998 )
@@ -2843,7 +2851,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: 423 | 313 passed | 90 failed | 6 skipped | 14 failed as expected
assertions: 2273 | 2087 passed | 151 failed | 35 failed as expected
test cases: 428 | 313 passed | 95 failed | 6 skipped | 14 failed as expected
assertions: 2281 | 2089 passed | 157 failed | 35 failed as expected

View File

@@ -47,8 +47,7 @@ Exception.tests.cpp:<line number>
Exception.tests.cpp:<line number>: FAILED:
{Unknown expression after the reported line}
due to unexpected exception with messages:
answer := 42
due to unexpected exception with message:
expected exception
-------------------------------------------------------------------------------
@@ -348,6 +347,28 @@ Exception.tests.cpp:<line number>: FAILED:
due to unexpected exception with message:
unexpected exception
-------------------------------------------------------------------------------
Captures do not leave block with an exception
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
a := 1
-------------------------------------------------------------------------------
Captures outlive section end
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
a := 1
-------------------------------------------------------------------------------
Contains string matcher
-------------------------------------------------------------------------------
@@ -988,6 +1009,44 @@ with expansion:
"this string contains 'abc' as a substring" matches "this string contains
'abc' as a" case sensitively
-------------------------------------------------------------------------------
Scoped message applies to all assertions in scope
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
CHECK( false )
with message:
This will be reported multiple times
Message.tests.cpp:<line number>: FAILED:
CHECK( false )
with message:
This will be reported multiple times
-------------------------------------------------------------------------------
Scoped messages do not leave block with an exception
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
Should be in scope at the end
-------------------------------------------------------------------------------
Scoped messages outlive section end
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
Should survive a section end
A string sent directly to stdout
A string sent directly to stderr
A string sent to stderr via clog
@@ -1613,6 +1672,6 @@ due to unexpected exception with message:
Why would you throw a std::string?
===============================================================================
test cases: 423 | 331 passed | 71 failed | 7 skipped | 14 failed as expected
assertions: 2252 | 2087 passed | 130 failed | 35 failed as expected
test cases: 428 | 331 passed | 76 failed | 7 skipped | 14 failed as expected
assertions: 2260 | 2089 passed | 136 failed | 35 failed as expected

View File

@@ -781,8 +781,7 @@ Exception.tests.cpp:<line number>
Exception.tests.cpp:<line number>: FAILED:
{Unknown expression after the reported line}
due to unexpected exception with messages:
answer := 42
due to unexpected exception with message:
expected exception
-------------------------------------------------------------------------------
@@ -2867,6 +2866,40 @@ ToStringGeneral.tests.cpp:<line number>: PASSED:
with message:
3
-------------------------------------------------------------------------------
Captures do not leave block with an exception
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
a := 1
-------------------------------------------------------------------------------
Captures outlive section end
Dummy section
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: PASSED:
CHECK( true )
with message:
a := 1
-------------------------------------------------------------------------------
Captures outlive section end
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
a := 1
-------------------------------------------------------------------------------
CaseInsensitiveEqualsTo is case insensitive
Degenerate cases
@@ -11026,6 +11059,56 @@ BDD.tests.cpp:<line number>: PASSED:
with expansion:
0 == 0
-------------------------------------------------------------------------------
Scoped message applies to all assertions in scope
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
CHECK( false )
with message:
This will be reported multiple times
Message.tests.cpp:<line number>: FAILED:
CHECK( false )
with message:
This will be reported multiple times
-------------------------------------------------------------------------------
Scoped messages do not leave block with an exception
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
Should be in scope at the end
-------------------------------------------------------------------------------
Scoped messages outlive section end
Dummy section
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: PASSED:
CHECK( true )
with message:
Should survive a section end
-------------------------------------------------------------------------------
Scoped messages outlive section end
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
Should survive a section end
A string sent directly to stdout
A string sent directly to stderr
A string sent to stderr via clog
@@ -19051,6 +19134,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 423 | 313 passed | 90 failed | 6 skipped | 14 failed as expected
assertions: 2273 | 2087 passed | 151 failed | 35 failed as expected
test cases: 428 | 313 passed | 95 failed | 6 skipped | 14 failed as expected
assertions: 2281 | 2089 passed | 157 failed | 35 failed as expected

View File

@@ -779,8 +779,7 @@ Exception.tests.cpp:<line number>
Exception.tests.cpp:<line number>: FAILED:
{Unknown expression after the reported line}
due to unexpected exception with messages:
answer := 42
due to unexpected exception with message:
expected exception
-------------------------------------------------------------------------------
@@ -2865,6 +2864,40 @@ ToStringGeneral.tests.cpp:<line number>: PASSED:
with message:
3
-------------------------------------------------------------------------------
Captures do not leave block with an exception
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
a := 1
-------------------------------------------------------------------------------
Captures outlive section end
Dummy section
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: PASSED:
CHECK( true )
with message:
a := 1
-------------------------------------------------------------------------------
Captures outlive section end
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
a := 1
-------------------------------------------------------------------------------
CaseInsensitiveEqualsTo is case insensitive
Degenerate cases
@@ -11024,6 +11057,56 @@ BDD.tests.cpp:<line number>: PASSED:
with expansion:
0 == 0
-------------------------------------------------------------------------------
Scoped message applies to all assertions in scope
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
CHECK( false )
with message:
This will be reported multiple times
Message.tests.cpp:<line number>: FAILED:
CHECK( false )
with message:
This will be reported multiple times
-------------------------------------------------------------------------------
Scoped messages do not leave block with an exception
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
Should be in scope at the end
-------------------------------------------------------------------------------
Scoped messages outlive section end
Dummy section
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: PASSED:
CHECK( true )
with message:
Should survive a section end
-------------------------------------------------------------------------------
Scoped messages outlive section end
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
Should survive a section end
-------------------------------------------------------------------------------
Sends stuff to stdout and stderr
-------------------------------------------------------------------------------
@@ -19040,6 +19123,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 423 | 313 passed | 90 failed | 6 skipped | 14 failed as expected
assertions: 2273 | 2087 passed | 151 failed | 35 failed as expected
test cases: 428 | 313 passed | 95 failed | 6 skipped | 14 failed as expected
assertions: 2281 | 2089 passed | 157 failed | 35 failed as expected

View File

@@ -781,8 +781,7 @@ Exception.tests.cpp:<line number>
Exception.tests.cpp:<line number>: FAILED:
{Unknown expression after the reported line}
due to unexpected exception with messages:
answer := 42
due to unexpected exception with message:
expected exception
-------------------------------------------------------------------------------

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact
>
<testsuite name="<exe-name>" errors="17" failures="134" skipped="12" tests="2285" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="140" skipped="12" tests="2293" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>
@@ -67,7 +67,6 @@ at Generators.tests.cpp:<line number>
FAILED:
{Unknown expression after the reported line}
expected exception
answer := 42
at Exception.tests.cpp:<line number>
</error>
</testcase>
@@ -412,6 +411,23 @@ at Exception.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Capture and info messages" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Capture and info messages/Capture should stringify like assertions" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Capture and info messages/Info should NOT stringify the way assertions do" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Captures do not leave block with an exception" time="{duration}" status="run">
<failure message="false" type="REQUIRE">
FAILED:
REQUIRE( false )
a := 1
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Captures outlive section end" time="{duration}" status="run">
<failure message="false" type="REQUIRE">
FAILED:
REQUIRE( false )
a := 1
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Captures outlive section end/Dummy section" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="CaseInsensitiveEqualsTo is case insensitive" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="CaseInsensitiveEqualsTo is case insensitive/Degenerate cases" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="CaseInsensitiveEqualsTo is case insensitive/Plain comparisons" time="{duration}" status="run"/>
@@ -1350,6 +1366,37 @@ at Matchers.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector/When: it is made larger/Then: the size and capacity go up/And when: it is made smaller again/Then: the size goes down but the capacity stays the same" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector/When: we reserve more space" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector/When: we reserve more space/Then: The capacity is increased but the size remains the same" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Scoped message applies to all assertions in scope" time="{duration}" status="run">
<failure message="false" type="CHECK">
FAILED:
CHECK( false )
This will be reported multiple times
at Message.tests.cpp:<line number>
</failure>
<failure message="false" type="CHECK">
FAILED:
CHECK( false )
This will be reported multiple times
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Scoped messages do not leave block with an exception" time="{duration}" status="run">
<failure message="false" type="REQUIRE">
FAILED:
REQUIRE( false )
Should be in scope at the end
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Scoped messages outlive section end" time="{duration}" status="run">
<failure message="false" type="REQUIRE">
FAILED:
REQUIRE( false )
Should survive a section end
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Scoped messages outlive section end/Dummy section" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Sends stuff to stdout and stderr" time="{duration}" status="run">
<system-out>
A string sent directly to stdout

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="<exe-name>" errors="17" failures="134" skipped="12" tests="2285" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="140" skipped="12" tests="2293" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>
@@ -66,7 +66,6 @@ at Generators.tests.cpp:<line number>
FAILED:
{Unknown expression after the reported line}
expected exception
answer := 42
at Exception.tests.cpp:<line number>
</error>
</testcase>
@@ -411,6 +410,23 @@ at Exception.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Capture and info messages" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Capture and info messages/Capture should stringify like assertions" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Capture and info messages/Info should NOT stringify the way assertions do" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Captures do not leave block with an exception" time="{duration}" status="run">
<failure message="false" type="REQUIRE">
FAILED:
REQUIRE( false )
a := 1
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Captures outlive section end" time="{duration}" status="run">
<failure message="false" type="REQUIRE">
FAILED:
REQUIRE( false )
a := 1
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Captures outlive section end/Dummy section" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="CaseInsensitiveEqualsTo is case insensitive" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="CaseInsensitiveEqualsTo is case insensitive/Degenerate cases" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="CaseInsensitiveEqualsTo is case insensitive/Plain comparisons" time="{duration}" status="run"/>
@@ -1349,6 +1365,37 @@ at Matchers.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector/When: it is made larger/Then: the size and capacity go up/And when: it is made smaller again/Then: the size goes down but the capacity stays the same" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector/When: we reserve more space" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector/When: we reserve more space/Then: The capacity is increased but the size remains the same" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Scoped message applies to all assertions in scope" time="{duration}" status="run">
<failure message="false" type="CHECK">
FAILED:
CHECK( false )
This will be reported multiple times
at Message.tests.cpp:<line number>
</failure>
<failure message="false" type="CHECK">
FAILED:
CHECK( false )
This will be reported multiple times
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Scoped messages do not leave block with an exception" time="{duration}" status="run">
<failure message="false" type="REQUIRE">
FAILED:
REQUIRE( false )
Should be in scope at the end
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Scoped messages outlive section end" time="{duration}" status="run">
<failure message="false" type="REQUIRE">
FAILED:
REQUIRE( false )
Should survive a section end
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Scoped messages outlive section end/Dummy section" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Sends stuff to stdout and stderr" time="{duration}" status="run">
<system-out>
A string sent directly to stdout

View File

@@ -1012,7 +1012,6 @@ at Decomposition.tests.cpp:<line number>
FAILED:
{Unknown expression after the reported line}
expected exception
answer := 42
at Exception.tests.cpp:<line number>
</skipped>
</testCase>
@@ -1637,6 +1636,23 @@ at Matchers.tests.cpp:<line number>
<testCase name="CAPTURE can deal with complex expressions" duration="{duration}"/>
<testCase name="CAPTURE can deal with complex expressions involving commas" duration="{duration}"/>
<testCase name="CAPTURE parses string and character constants" duration="{duration}"/>
<testCase name="Captures do not leave block with an exception" duration="{duration}">
<failure message="REQUIRE(false)">
FAILED:
REQUIRE( false )
a := 1
at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="Captures outlive section end" duration="{duration}">
<failure message="REQUIRE(false)">
FAILED:
REQUIRE( false )
a := 1
at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="Captures outlive section end/Dummy section" duration="{duration}"/>
<testCase name="FAIL aborts the test" duration="{duration}">
<failure message="FAIL()">
FAILED:
@@ -1726,6 +1742,37 @@ at Message.tests.cpp:<line number>
</testCase>
<testCase name="SUCCEED counts as a test pass" duration="{duration}"/>
<testCase name="SUCCEED does not require an argument" duration="{duration}"/>
<testCase name="Scoped message applies to all assertions in scope" duration="{duration}">
<failure message="CHECK(false)">
FAILED:
CHECK( false )
This will be reported multiple times
at Message.tests.cpp:<line number>
</failure>
<failure message="CHECK(false)">
FAILED:
CHECK( false )
This will be reported multiple times
at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="Scoped messages do not leave block with an exception" duration="{duration}">
<failure message="REQUIRE(false)">
FAILED:
REQUIRE( false )
Should be in scope at the end
at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="Scoped messages outlive section end" duration="{duration}">
<failure message="REQUIRE(false)">
FAILED:
REQUIRE( false )
Should survive a section end
at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="Scoped messages outlive section end/Dummy section" duration="{duration}"/>
<testCase name="Standard output from all sections is reported" duration="{duration}"/>
<testCase name="Standard output from all sections is reported/one" duration="{duration}"/>
<testCase name="Standard output from all sections is reported/two" duration="{duration}"/>

View File

@@ -1011,7 +1011,6 @@ at Decomposition.tests.cpp:<line number>
FAILED:
{Unknown expression after the reported line}
expected exception
answer := 42
at Exception.tests.cpp:<line number>
</skipped>
</testCase>
@@ -1636,6 +1635,23 @@ at Matchers.tests.cpp:<line number>
<testCase name="CAPTURE can deal with complex expressions" duration="{duration}"/>
<testCase name="CAPTURE can deal with complex expressions involving commas" duration="{duration}"/>
<testCase name="CAPTURE parses string and character constants" duration="{duration}"/>
<testCase name="Captures do not leave block with an exception" duration="{duration}">
<failure message="REQUIRE(false)">
FAILED:
REQUIRE( false )
a := 1
at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="Captures outlive section end" duration="{duration}">
<failure message="REQUIRE(false)">
FAILED:
REQUIRE( false )
a := 1
at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="Captures outlive section end/Dummy section" duration="{duration}"/>
<testCase name="FAIL aborts the test" duration="{duration}">
<failure message="FAIL()">
FAILED:
@@ -1725,6 +1741,37 @@ at Message.tests.cpp:<line number>
</testCase>
<testCase name="SUCCEED counts as a test pass" duration="{duration}"/>
<testCase name="SUCCEED does not require an argument" duration="{duration}"/>
<testCase name="Scoped message applies to all assertions in scope" duration="{duration}">
<failure message="CHECK(false)">
FAILED:
CHECK( false )
This will be reported multiple times
at Message.tests.cpp:<line number>
</failure>
<failure message="CHECK(false)">
FAILED:
CHECK( false )
This will be reported multiple times
at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="Scoped messages do not leave block with an exception" duration="{duration}">
<failure message="REQUIRE(false)">
FAILED:
REQUIRE( false )
Should be in scope at the end
at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="Scoped messages outlive section end" duration="{duration}">
<failure message="REQUIRE(false)">
FAILED:
REQUIRE( false )
Should survive a section end
at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="Scoped messages outlive section end/Dummy section" duration="{duration}"/>
<testCase name="Standard output from all sections is reported" duration="{duration}"/>
<testCase name="Standard output from all sections is reported/one" duration="{duration}"/>
<testCase name="Standard output from all sections is reported/two" duration="{duration}"/>

View File

@@ -167,7 +167,7 @@ ok {test-number} - smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0
# #2615 - Throwing in constructor generator fails test case but does not abort
not ok {test-number} - unexpected exception with message: 'failure to init'; expression was: {Unknown expression after the reported line}
# #748 - captures with unexpected exceptions
not ok {test-number} - unexpected exception with message: 'answer := 42'; expression was: {Unknown expression after the reported line} with 1 message: 'expected exception'
not ok {test-number} - unexpected exception with message: 'expected exception'; expression was: {Unknown expression after the reported line}
# #748 - captures with unexpected exceptions
not ok {test-number} - unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception'
# #748 - captures with unexpected exceptions
@@ -674,6 +674,12 @@ ok {test-number} - with 11 messages: '("comma, in string", "escaped, \", ") := "
ok {test-number} - true with 1 message: 'i := 2'
# Capture and info messages
ok {test-number} - true with 1 message: '3'
# Captures do not leave block with an exception
not ok {test-number} - false with 1 message: 'a := 1'
# Captures outlive section end
ok {test-number} - true with 1 message: 'a := 1'
# Captures outlive section end
not ok {test-number} - false with 1 message: 'a := 1'
# CaseInsensitiveEqualsTo is case insensitive
ok {test-number} - eq( "", "" ) for: true
# CaseInsensitiveEqualsTo is case insensitive
@@ -2616,6 +2622,16 @@ ok {test-number} - v.size() == 0 for: 0 == 0
ok {test-number} - v.capacity() >= 10 for: 10 >= 10
# Scenario: Vector resizing affects size and capacity
ok {test-number} - v.size() == 0 for: 0 == 0
# Scoped message applies to all assertions in scope
not ok {test-number} - false with 1 message: 'This will be reported multiple times'
# Scoped message applies to all assertions in scope
not ok {test-number} - false with 1 message: 'This will be reported multiple times'
# Scoped messages do not leave block with an exception
not ok {test-number} - false with 1 message: 'Should be in scope at the end'
# Scoped messages outlive section end
ok {test-number} - true with 1 message: 'Should survive a section end'
# Scoped messages outlive section end
not ok {test-number} - false with 1 message: 'Should survive a section end'
A string sent directly to stdout
A string sent directly to stderr
A string sent to stderr via clog
@@ -4567,5 +4583,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
1..2285
1..2293

View File

@@ -165,7 +165,7 @@ ok {test-number} - smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0
# #2615 - Throwing in constructor generator fails test case but does not abort
not ok {test-number} - unexpected exception with message: 'failure to init'; expression was: {Unknown expression after the reported line}
# #748 - captures with unexpected exceptions
not ok {test-number} - unexpected exception with message: 'answer := 42'; expression was: {Unknown expression after the reported line} with 1 message: 'expected exception'
not ok {test-number} - unexpected exception with message: 'expected exception'; expression was: {Unknown expression after the reported line}
# #748 - captures with unexpected exceptions
not ok {test-number} - unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception'
# #748 - captures with unexpected exceptions
@@ -672,6 +672,12 @@ ok {test-number} - with 11 messages: '("comma, in string", "escaped, \", ") := "
ok {test-number} - true with 1 message: 'i := 2'
# Capture and info messages
ok {test-number} - true with 1 message: '3'
# Captures do not leave block with an exception
not ok {test-number} - false with 1 message: 'a := 1'
# Captures outlive section end
ok {test-number} - true with 1 message: 'a := 1'
# Captures outlive section end
not ok {test-number} - false with 1 message: 'a := 1'
# CaseInsensitiveEqualsTo is case insensitive
ok {test-number} - eq( "", "" ) for: true
# CaseInsensitiveEqualsTo is case insensitive
@@ -2614,6 +2620,16 @@ ok {test-number} - v.size() == 0 for: 0 == 0
ok {test-number} - v.capacity() >= 10 for: 10 >= 10
# Scenario: Vector resizing affects size and capacity
ok {test-number} - v.size() == 0 for: 0 == 0
# Scoped message applies to all assertions in scope
not ok {test-number} - false with 1 message: 'This will be reported multiple times'
# Scoped message applies to all assertions in scope
not ok {test-number} - false with 1 message: 'This will be reported multiple times'
# Scoped messages do not leave block with an exception
not ok {test-number} - false with 1 message: 'Should be in scope at the end'
# Scoped messages outlive section end
ok {test-number} - true with 1 message: 'Should survive a section end'
# Scoped messages outlive section end
not ok {test-number} - false with 1 message: 'Should survive a section end'
# Some simple comparisons between doubles
ok {test-number} - d == Approx( 1.23 ) for: 1.22999999999999998 == Approx( 1.22999999999999998 )
# Some simple comparisons between doubles
@@ -4556,5 +4572,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
1..2285
1..2293

View File

@@ -56,7 +56,7 @@
##teamcity[testIgnored name='#2615 - Throwing in constructor generator fails test case but does not abort' message='Generators.tests.cpp:<line number>|n...............................................................................|n|nGenerators.tests.cpp:<line number>|nunexpected exception with message:|n "failure to init"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n- failure ignore as test marked as |'ok to fail|'|n']
##teamcity[testFinished name='#2615 - Throwing in constructor generator fails test case but does not abort' duration="{duration}"]
##teamcity[testStarted name='#748 - captures with unexpected exceptions']
##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|noutside assertions|n-------------------------------------------------------------------------------|nException.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n- failure ignore as test marked as |'ok to fail|'|n']
##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|noutside assertions|n-------------------------------------------------------------------------------|nException.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n- failure ignore as test marked as |'ok to fail|'|n']
##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|ninside REQUIRE_NOTHROW|n-------------------------------------------------------------------------------|nException.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n REQUIRE_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n- failure ignore as test marked as |'ok to fail|'|n']
##teamcity[testFinished name='#748 - captures with unexpected exceptions' duration="{duration}"]
##teamcity[testStarted name='#809']
@@ -239,6 +239,12 @@
##teamcity[testFinished name='CAPTURE parses string and character constants' duration="{duration}"]
##teamcity[testStarted name='Capture and info messages']
##teamcity[testFinished name='Capture and info messages' duration="{duration}"]
##teamcity[testStarted name='Captures do not leave block with an exception']
##teamcity[testFailed name='Captures do not leave block with an exception' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "a := 1"|n REQUIRE( false )|nwith expansion:|n false|n']
##teamcity[testFinished name='Captures do not leave block with an exception' duration="{duration}"]
##teamcity[testStarted name='Captures outlive section end']
##teamcity[testFailed name='Captures outlive section end' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "a := 1"|n REQUIRE( false )|nwith expansion:|n false|n']
##teamcity[testFinished name='Captures outlive section end' duration="{duration}"]
##teamcity[testStarted name='CaseInsensitiveEqualsTo is case insensitive']
##teamcity[testFinished name='CaseInsensitiveEqualsTo is case insensitive' duration="{duration}"]
##teamcity[testStarted name='CaseInsensitiveLess is case insensitive']
@@ -566,6 +572,16 @@
##teamcity[testFinished name='Scenario: This is a really long scenario name to see how the list command deals with wrapping' duration="{duration}"]
##teamcity[testStarted name='Scenario: Vector resizing affects size and capacity']
##teamcity[testFinished name='Scenario: Vector resizing affects size and capacity' duration="{duration}"]
##teamcity[testStarted name='Scoped message applies to all assertions in scope']
##teamcity[testFailed name='Scoped message applies to all assertions in scope' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "This will be reported multiple times"|n CHECK( false )|nwith expansion:|n false|n']
##teamcity[testFailed name='Scoped message applies to all assertions in scope' message='Message.tests.cpp:<line number>|nexpression failed with message:|n "This will be reported multiple times"|n CHECK( false )|nwith expansion:|n false|n']
##teamcity[testFinished name='Scoped message applies to all assertions in scope' duration="{duration}"]
##teamcity[testStarted name='Scoped messages do not leave block with an exception']
##teamcity[testFailed name='Scoped messages do not leave block with an exception' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "Should be in scope at the end"|n REQUIRE( false )|nwith expansion:|n false|n']
##teamcity[testFinished name='Scoped messages do not leave block with an exception' duration="{duration}"]
##teamcity[testStarted name='Scoped messages outlive section end']
##teamcity[testFailed name='Scoped messages outlive section end' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "Should survive a section end"|n REQUIRE( false )|nwith expansion:|n false|n']
##teamcity[testFinished name='Scoped messages outlive section end' duration="{duration}"]
##teamcity[testStarted name='Sends stuff to stdout and stderr']
##teamcity[testStdOut name='Sends stuff to stdout and stderr' out='A string sent directly to stdout|n']
##teamcity[testStdErr name='Sends stuff to stdout and stderr' out='A string sent directly to stderr|nA string sent to stderr via clog|n']

View File

@@ -56,7 +56,7 @@
##teamcity[testIgnored name='#2615 - Throwing in constructor generator fails test case but does not abort' message='Generators.tests.cpp:<line number>|n...............................................................................|n|nGenerators.tests.cpp:<line number>|nunexpected exception with message:|n "failure to init"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n- failure ignore as test marked as |'ok to fail|'|n']
##teamcity[testFinished name='#2615 - Throwing in constructor generator fails test case but does not abort' duration="{duration}"]
##teamcity[testStarted name='#748 - captures with unexpected exceptions']
##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|noutside assertions|n-------------------------------------------------------------------------------|nException.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n- failure ignore as test marked as |'ok to fail|'|n']
##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|noutside assertions|n-------------------------------------------------------------------------------|nException.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n- failure ignore as test marked as |'ok to fail|'|n']
##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|ninside REQUIRE_NOTHROW|n-------------------------------------------------------------------------------|nException.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n REQUIRE_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n- failure ignore as test marked as |'ok to fail|'|n']
##teamcity[testFinished name='#748 - captures with unexpected exceptions' duration="{duration}"]
##teamcity[testStarted name='#809']
@@ -239,6 +239,12 @@
##teamcity[testFinished name='CAPTURE parses string and character constants' duration="{duration}"]
##teamcity[testStarted name='Capture and info messages']
##teamcity[testFinished name='Capture and info messages' duration="{duration}"]
##teamcity[testStarted name='Captures do not leave block with an exception']
##teamcity[testFailed name='Captures do not leave block with an exception' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "a := 1"|n REQUIRE( false )|nwith expansion:|n false|n']
##teamcity[testFinished name='Captures do not leave block with an exception' duration="{duration}"]
##teamcity[testStarted name='Captures outlive section end']
##teamcity[testFailed name='Captures outlive section end' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "a := 1"|n REQUIRE( false )|nwith expansion:|n false|n']
##teamcity[testFinished name='Captures outlive section end' duration="{duration}"]
##teamcity[testStarted name='CaseInsensitiveEqualsTo is case insensitive']
##teamcity[testFinished name='CaseInsensitiveEqualsTo is case insensitive' duration="{duration}"]
##teamcity[testStarted name='CaseInsensitiveLess is case insensitive']
@@ -566,6 +572,16 @@
##teamcity[testFinished name='Scenario: This is a really long scenario name to see how the list command deals with wrapping' duration="{duration}"]
##teamcity[testStarted name='Scenario: Vector resizing affects size and capacity']
##teamcity[testFinished name='Scenario: Vector resizing affects size and capacity' duration="{duration}"]
##teamcity[testStarted name='Scoped message applies to all assertions in scope']
##teamcity[testFailed name='Scoped message applies to all assertions in scope' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "This will be reported multiple times"|n CHECK( false )|nwith expansion:|n false|n']
##teamcity[testFailed name='Scoped message applies to all assertions in scope' message='Message.tests.cpp:<line number>|nexpression failed with message:|n "This will be reported multiple times"|n CHECK( false )|nwith expansion:|n false|n']
##teamcity[testFinished name='Scoped message applies to all assertions in scope' duration="{duration}"]
##teamcity[testStarted name='Scoped messages do not leave block with an exception']
##teamcity[testFailed name='Scoped messages do not leave block with an exception' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "Should be in scope at the end"|n REQUIRE( false )|nwith expansion:|n false|n']
##teamcity[testFinished name='Scoped messages do not leave block with an exception' duration="{duration}"]
##teamcity[testStarted name='Scoped messages outlive section end']
##teamcity[testFailed name='Scoped messages outlive section end' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "Should survive a section end"|n REQUIRE( false )|nwith expansion:|n false|n']
##teamcity[testFinished name='Scoped messages outlive section end' duration="{duration}"]
##teamcity[testStarted name='Sends stuff to stdout and stderr']
##teamcity[testStdOut name='Sends stuff to stdout and stderr' out='A string sent directly to stdout|n']
##teamcity[testStdErr name='Sends stuff to stdout and stderr' out='A string sent directly to stderr|nA string sent to stderr via clog|n']

View File

@@ -683,9 +683,6 @@ Nor would this
</TestCase>
<TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
<Section name="outside assertions" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
answer := 42
</Info>
<Expression success="false" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
<Original>
{Unknown expression after the reported line}
@@ -3090,6 +3087,48 @@ Approx( 1.23399996757507324 )
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Captures do not leave block with an exception" tags="[.][capture][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
a := 1
</Info>
<Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false" skips="0"/>
</TestCase>
<TestCase name="Captures outlive section end" tags="[.][failing][info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Section name="Dummy section" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
a := 1
</Info>
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
true
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
a := 1
</Info>
<Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false" skips="0"/>
</TestCase>
<TestCase name="CaseInsensitiveEqualsTo is case insensitive" tags="[comparisons][string-case]" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
<Section name="Degenerate cases" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
@@ -12893,6 +12932,73 @@ All available test cases:
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Scoped message applies to all assertions in scope" tags="[.][failing][info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
This will be reported multiple times
</Info>
<Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
This will be reported multiple times
</Info>
<Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false" skips="0"/>
</TestCase>
<TestCase name="Scoped messages do not leave block with an exception" tags="[.][failing][info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
Should be in scope at the end
</Info>
<Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false" skips="0"/>
</TestCase>
<TestCase name="Scoped messages outlive section end" tags="[.][failing][info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Section name="Dummy section" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
Should survive a section end
</Info>
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
true
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
Should survive a section end
</Info>
<Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false" skips="0"/>
</TestCase>
<TestCase name="Sends stuff to stdout and stderr" tags="[.]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<OverallResult success="false" skips="0">
<StdOut>
@@ -22007,6 +22113,6 @@ Approx( -1.95996398454005449 )
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<OverallResults successes="2087" failures="151" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="313" failures="90" expectedFailures="14" skips="6"/>
<OverallResults successes="2089" failures="157" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="313" failures="95" expectedFailures="14" skips="6"/>
</Catch2TestRun>

View File

@@ -683,9 +683,6 @@ Nor would this
</TestCase>
<TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
<Section name="outside assertions" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
answer := 42
</Info>
<Expression success="false" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
<Original>
{Unknown expression after the reported line}
@@ -3090,6 +3087,48 @@ Approx( 1.23399996757507324 )
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Captures do not leave block with an exception" tags="[.][capture][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
a := 1
</Info>
<Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false" skips="0"/>
</TestCase>
<TestCase name="Captures outlive section end" tags="[.][failing][info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Section name="Dummy section" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
a := 1
</Info>
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
true
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
a := 1
</Info>
<Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false" skips="0"/>
</TestCase>
<TestCase name="CaseInsensitiveEqualsTo is case insensitive" tags="[comparisons][string-case]" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
<Section name="Degenerate cases" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
@@ -12893,6 +12932,73 @@ All available test cases:
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Scoped message applies to all assertions in scope" tags="[.][failing][info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
This will be reported multiple times
</Info>
<Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
This will be reported multiple times
</Info>
<Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false" skips="0"/>
</TestCase>
<TestCase name="Scoped messages do not leave block with an exception" tags="[.][failing][info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
Should be in scope at the end
</Info>
<Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false" skips="0"/>
</TestCase>
<TestCase name="Scoped messages outlive section end" tags="[.][failing][info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Section name="Dummy section" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
Should survive a section end
</Info>
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
true
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
Should survive a section end
</Info>
<Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false" skips="0"/>
</TestCase>
<TestCase name="Sends stuff to stdout and stderr" tags="[.]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<OverallResult success="false" skips="0">
<StdOut>
@@ -22006,6 +22112,6 @@ Approx( -1.95996398454005449 )
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<OverallResults successes="2087" failures="151" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="313" failures="90" expectedFailures="14" skips="6"/>
<OverallResults successes="2089" failures="157" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="313" failures="95" expectedFailures="14" skips="6"/>
</Catch2TestRun>

View File

@@ -310,3 +310,53 @@ TEST_CASE( "INFO and UNSCOPED_INFO can stream multiple arguments",
<< " parts." );
FAIL( "Show infos!" );
}
TEST_CASE( "Scoped messages do not leave block with an exception", "[messages][info][.failing]" ) {
INFO( "Should be in scope at the end" );
{ INFO( "This should go out of scope immediately" ); }
try {
INFO( "Should not be in scope at the end" );
throw std::runtime_error( "ex" );
} catch (std::exception const&) {}
REQUIRE( false );
}
TEST_CASE( "Captures do not leave block with an exception",
"[messages][capture][.failing]" ) {
int a = 1, b = 2, c = 3;
CAPTURE( a );
{ CAPTURE( b ); }
try {
CAPTURE( c );
throw std::runtime_error( "ex" );
} catch ( std::exception const& ) {}
REQUIRE( false );
}
TEST_CASE( "Scoped messages outlive section end",
"[messages][info][.failing]" ) {
INFO( "Should survive a section end" );
SECTION( "Dummy section" ) { CHECK( true ); }
REQUIRE( false );
}
TEST_CASE( "Captures outlive section end", "[messages][info][.failing]" ) {
int a = 1;
CAPTURE( a );
SECTION( "Dummy section" ) { CHECK( true ); }
REQUIRE( false );
}
TEST_CASE( "Scoped message applies to all assertions in scope",
"[messages][info][.failing]" ) {
INFO( "This will be reported multiple times" );
CHECK( false );
CHECK( false );
}