Fix lazy removal of unscoped messages also removing still valid msgs

This commit is contained in:
Martin Hořeňovský
2025-11-30 12:56:06 +01:00
parent a1faad9315
commit 985a3f4460
21 changed files with 222 additions and 18 deletions

View File

@@ -138,6 +138,7 @@ Nor would this
:test-result: FAIL Custom exceptions can be translated when testing for throwing as something else
:test-result: FAIL Custom std-exceptions can be custom translated
:test-result: PASS Default scale is invisible to comparison
:test-result: XFAIL Delayed unscoped message clearing does not catch newly inserted messages
:test-result: PASS Directly creating an EnumInfo
:test-result: SKIP Empty generators can SKIP in constructor
:test-result: PASS Empty stream name opens cout stream

View File

@@ -136,6 +136,7 @@
:test-result: FAIL Custom exceptions can be translated when testing for throwing as something else
:test-result: FAIL Custom std-exceptions can be custom translated
:test-result: PASS Default scale is invisible to comparison
:test-result: XFAIL Delayed unscoped message clearing does not catch newly inserted messages
:test-result: PASS Directly creating an EnumInfo
:test-result: SKIP Empty generators can SKIP in constructor
:test-result: PASS Empty stream name opens cout stream

View File

@@ -562,6 +562,8 @@ Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'c
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom std exception'
Approx.tests.cpp:<line number>: passed: 101.000001 != Approx(100).epsilon(0.01) for: 101.00000099999999748 != Approx( 100.0 )
Approx.tests.cpp:<line number>: passed: std::pow(10, -5) != Approx(std::pow(10, -7)) for: 0.00001 != Approx( 0.0000001 )
Message.tests.cpp:<line number>: passed: true with 1 message: 'a'
Message.tests.cpp:<line number>: failed: false with 1 message: 'b'
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(0) == "Value1" for: Value1 == "Value1"
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: Value2 == "Value2"
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **}
@@ -2888,7 +2890,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: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
assertions: 2303 | 2105 passed | 157 failed | 41 failed as expected
test cases: 436 | 317 passed | 95 failed | 6 skipped | 18 failed as expected
assertions: 2305 | 2106 passed | 157 failed | 42 failed as expected

View File

@@ -560,6 +560,8 @@ Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'c
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom std exception'
Approx.tests.cpp:<line number>: passed: 101.000001 != Approx(100).epsilon(0.01) for: 101.00000099999999748 != Approx( 100.0 )
Approx.tests.cpp:<line number>: passed: std::pow(10, -5) != Approx(std::pow(10, -7)) for: 0.00001 != Approx( 0.0000001 )
Message.tests.cpp:<line number>: passed: true with 1 message: 'a'
Message.tests.cpp:<line number>: failed: false with 1 message: 'b'
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(0) == "Value1" for: Value1 == "Value1"
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: Value2 == "Value2"
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **}
@@ -2877,7 +2879,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: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
assertions: 2303 | 2105 passed | 157 failed | 41 failed as expected
test cases: 436 | 317 passed | 95 failed | 6 skipped | 18 failed as expected
assertions: 2305 | 2106 passed | 157 failed | 42 failed as expected

View File

@@ -450,6 +450,17 @@ Exception.tests.cpp:<line number>: FAILED:
due to unexpected exception with message:
custom std exception
-------------------------------------------------------------------------------
Delayed unscoped message clearing does not catch newly inserted messages
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
b
-------------------------------------------------------------------------------
Empty generators can SKIP in constructor
-------------------------------------------------------------------------------
@@ -1719,6 +1730,6 @@ due to unexpected exception with message:
Why would you throw a std::string?
===============================================================================
test cases: 435 | 335 passed | 76 failed | 7 skipped | 17 failed as expected
assertions: 2282 | 2105 passed | 136 failed | 41 failed as expected
test cases: 436 | 335 passed | 76 failed | 7 skipped | 18 failed as expected
assertions: 2284 | 2106 passed | 136 failed | 42 failed as expected

View File

@@ -4148,6 +4148,22 @@ Approx.tests.cpp:<line number>: PASSED:
with expansion:
0.00001 != Approx( 0.0000001 )
-------------------------------------------------------------------------------
Delayed unscoped message clearing does not catch newly inserted messages
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: PASSED:
REQUIRE( true )
with message:
a
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
b
-------------------------------------------------------------------------------
Directly creating an EnumInfo
-------------------------------------------------------------------------------
@@ -19295,6 +19311,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
assertions: 2303 | 2105 passed | 157 failed | 41 failed as expected
test cases: 436 | 317 passed | 95 failed | 6 skipped | 18 failed as expected
assertions: 2305 | 2106 passed | 157 failed | 42 failed as expected

View File

@@ -4146,6 +4146,22 @@ Approx.tests.cpp:<line number>: PASSED:
with expansion:
0.00001 != Approx( 0.0000001 )
-------------------------------------------------------------------------------
Delayed unscoped message clearing does not catch newly inserted messages
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: PASSED:
REQUIRE( true )
with message:
a
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
b
-------------------------------------------------------------------------------
Directly creating an EnumInfo
-------------------------------------------------------------------------------
@@ -19284,6 +19300,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
assertions: 2303 | 2105 passed | 157 failed | 41 failed as expected
test cases: 436 | 317 passed | 95 failed | 6 skipped | 18 failed as expected
assertions: 2305 | 2106 passed | 157 failed | 42 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="140" skipped="12" tests="2315" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="140" skipped="12" tests="2317" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>
@@ -547,6 +547,15 @@ at Exception.tests.cpp:<line number>
</error>
</testcase>
<testcase classname="<exe-name>.global" name="Default scale is invisible to comparison" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Delayed unscoped message clearing does not catch newly inserted messages" time="{duration}" status="run">
<skipped message="TEST_CASE tagged with !mayfail"/>
<failure message="false" type="REQUIRE">
FAILED:
REQUIRE( false )
b
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Directly creating an EnumInfo" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Empty generators can SKIP in constructor" time="{duration}" status="run">
<skipped type="SKIP">

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="<exe-name>" errors="17" failures="140" skipped="12" tests="2315" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="140" skipped="12" tests="2317" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>
@@ -546,6 +546,15 @@ at Exception.tests.cpp:<line number>
</error>
</testcase>
<testcase classname="<exe-name>.global" name="Default scale is invisible to comparison" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Delayed unscoped message clearing does not catch newly inserted messages" time="{duration}" status="run">
<skipped message="TEST_CASE tagged with !mayfail"/>
<failure message="false" type="REQUIRE">
FAILED:
REQUIRE( false )
b
at Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Directly creating an EnumInfo" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Empty generators can SKIP in constructor" time="{duration}" status="run">
<skipped type="SKIP">

View File

@@ -1699,6 +1699,14 @@ at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="Captures outlive section end/Dummy section" duration="{duration}"/>
<testCase name="Delayed unscoped message clearing does not catch newly inserted messages" duration="{duration}">
<skipped message="REQUIRE(false)">
FAILED:
REQUIRE( false )
b
at Message.tests.cpp:<line number>
</skipped>
</testCase>
<testCase name="FAIL aborts the test" duration="{duration}">
<failure message="FAIL()">
FAILED:

View File

@@ -1698,6 +1698,14 @@ at Message.tests.cpp:<line number>
</failure>
</testCase>
<testCase name="Captures outlive section end/Dummy section" duration="{duration}"/>
<testCase name="Delayed unscoped message clearing does not catch newly inserted messages" duration="{duration}">
<skipped message="REQUIRE(false)">
FAILED:
REQUIRE( false )
b
at Message.tests.cpp:<line number>
</skipped>
</testCase>
<testCase name="FAIL aborts the test" duration="{duration}">
<failure message="FAIL()">
FAILED:

View File

@@ -1024,6 +1024,10 @@ not ok {test-number} - unexpected exception with message: 'custom std exception'
ok {test-number} - 101.000001 != Approx(100).epsilon(0.01) for: 101.00000099999999748 != Approx( 100.0 )
# Default scale is invisible to comparison
ok {test-number} - std::pow(10, -5) != Approx(std::pow(10, -7)) for: 0.00001 != Approx( 0.0000001 )
# Delayed unscoped message clearing does not catch newly inserted messages
ok {test-number} - true with 1 message: 'a'
# Delayed unscoped message clearing does not catch newly inserted messages
not ok {test-number} - false with 1 message: 'b'
# Directly creating an EnumInfo
ok {test-number} - enumInfo->lookup(0) == "Value1" for: Value1 == "Value1"
# Directly creating an EnumInfo
@@ -4627,5 +4631,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
1..2315
1..2317

View File

@@ -1022,6 +1022,10 @@ not ok {test-number} - unexpected exception with message: 'custom std exception'
ok {test-number} - 101.000001 != Approx(100).epsilon(0.01) for: 101.00000099999999748 != Approx( 100.0 )
# Default scale is invisible to comparison
ok {test-number} - std::pow(10, -5) != Approx(std::pow(10, -7)) for: 0.00001 != Approx( 0.0000001 )
# Delayed unscoped message clearing does not catch newly inserted messages
ok {test-number} - true with 1 message: 'a'
# Delayed unscoped message clearing does not catch newly inserted messages
not ok {test-number} - false with 1 message: 'b'
# Directly creating an EnumInfo
ok {test-number} - enumInfo->lookup(0) == "Value1" for: Value1 == "Value1"
# Directly creating an EnumInfo
@@ -4616,5 +4620,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
1..2315
1..2317

View File

@@ -322,6 +322,9 @@
##teamcity[testFinished name='Custom std-exceptions can be custom translated' duration="{duration}"]
##teamcity[testStarted name='Default scale is invisible to comparison']
##teamcity[testFinished name='Default scale is invisible to comparison' duration="{duration}"]
##teamcity[testStarted name='Delayed unscoped message clearing does not catch newly inserted messages']
##teamcity[testIgnored name='Delayed unscoped message clearing does not catch newly inserted messages' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "b"|n REQUIRE( false )|nwith expansion:|n false|n- failure ignore as test marked as |'ok to fail|'|n']
##teamcity[testFinished name='Delayed unscoped message clearing does not catch newly inserted messages' duration="{duration}"]
##teamcity[testStarted name='Directly creating an EnumInfo']
##teamcity[testFinished name='Directly creating an EnumInfo' duration="{duration}"]
##teamcity[testStarted name='Empty generators can SKIP in constructor']

View File

@@ -322,6 +322,9 @@
##teamcity[testFinished name='Custom std-exceptions can be custom translated' duration="{duration}"]
##teamcity[testStarted name='Default scale is invisible to comparison']
##teamcity[testFinished name='Default scale is invisible to comparison' duration="{duration}"]
##teamcity[testStarted name='Delayed unscoped message clearing does not catch newly inserted messages']
##teamcity[testIgnored name='Delayed unscoped message clearing does not catch newly inserted messages' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "b"|n REQUIRE( false )|nwith expansion:|n false|n- failure ignore as test marked as |'ok to fail|'|n']
##teamcity[testFinished name='Delayed unscoped message clearing does not catch newly inserted messages' duration="{duration}"]
##teamcity[testStarted name='Directly creating an EnumInfo']
##teamcity[testFinished name='Directly creating an EnumInfo' duration="{duration}"]
##teamcity[testStarted name='Empty generators can SKIP in constructor']

View File

@@ -4613,6 +4613,31 @@ C
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Delayed unscoped message clearing does not catch newly inserted messages" tags="[!shouldfail][messages][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
a
</Info>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
true
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
b
</Info>
<Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Directly creating an EnumInfo" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
<Original>
@@ -22324,6 +22349,6 @@ Approx( -1.95996398454005449 )
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<OverallResults successes="2105" failures="157" expectedFailures="41" skips="12"/>
<OverallResultsCases successes="317" failures="95" expectedFailures="17" skips="6"/>
<OverallResults successes="2106" failures="157" expectedFailures="42" skips="12"/>
<OverallResultsCases successes="317" failures="95" expectedFailures="18" skips="6"/>
</Catch2TestRun>

View File

@@ -4613,6 +4613,31 @@ C
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Delayed unscoped message clearing does not catch newly inserted messages" tags="[!shouldfail][messages][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
a
</Info>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
true
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
b
</Info>
<Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Directly creating an EnumInfo" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
<Original>
@@ -22323,6 +22348,6 @@ Approx( -1.95996398454005449 )
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<OverallResults successes="2105" failures="157" expectedFailures="41" skips="12"/>
<OverallResultsCases successes="317" failures="95" expectedFailures="17" skips="6"/>
<OverallResults successes="2106" failures="157" expectedFailures="42" skips="12"/>
<OverallResultsCases successes="317" failures="95" expectedFailures="18" skips="6"/>
</Catch2TestRun>

View File

@@ -360,3 +360,12 @@ TEST_CASE( "Scoped message applies to all assertions in scope",
CHECK( false );
CHECK( false );
}
TEST_CASE(
"Delayed unscoped message clearing does not catch newly inserted messages",
"[messages][unscoped][!shouldfail]" ) {
UNSCOPED_INFO( "a" );
REQUIRE( true );
UNSCOPED_INFO( "b" );
REQUIRE( false );
}