Catch2
Catch2 copied to clipboard
Nested sections remove INFO output
Describe the bug When using nested sections, the 'INFO' output is retired too early.
Expected behavior The 'INFO' output stays in place for all relevant scopes.
Reproduction steps
In this example, the 'Info message!' is expected in both failure cases (4 == 1 and 2 == 1)
TEST_CASE( "NestedSection", "[broken]" ) {
INFO( "Info message!" );
SECTION( "outer" ) {
SECTION( "inner" )
{
CHECK( 4 == 1 ); // The info shows fine here
}
CHECK( 2 == 1 ); // The info does not show up for this failing check
}
}
Platform information:
- OS: Windows 10 22H2
- Compiler+version: **MSVC 2022 **
- Catch version: v3.8.0
I debugged it a bit this does not take into account that you can have nested sections at all
I'm struggling to find a reference, but I believe it's strongly recommended to not have statements after SECTIONs because of these types of issues.
Thanks!