Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behaviour of nested sections #1670

Closed
sfranzen opened this issue Jun 27, 2019 · 2 comments · Fixed by #1673
Closed

Inconsistent behaviour of nested sections #1670

sfranzen opened this issue Jun 27, 2019 · 2 comments · Fixed by #1673
Labels

Comments

@sfranzen
Copy link
Contributor

Describe the bug
Suppose I have a test case with a structure like the following:

TEST_CASE("Nesting")
{
    SECTION("A") {
        SECTION("1") SUCCEED();
        SECTION("2") SUCCEED();
    }
    SECTION("B") {
        SECTION("1") SUCCEED();
        SECTION("2") SUCCEED();
    }
}

Upon selecting the test case and section on the command line, I get the following results:

  • ./test Nesting: All four assertions are executed;
  • ./test Nesting -c A: Only A1 is executed;
  • ./test Nesting -c B: B1 and B2 are executed.

Expected behavior
./test Nesting -c A should execute all subsections of section A.

Reproduction steps
See description.

Platform information:

  • Compiler+version: GCC v9.1.1
  • Catch version: v2.8.0, v2.9.1
@horenmar
Copy link
Member

Thanks for the report.

Upon further investigation, this was introduced by #1492 and affects all sections that are not the last section, in other words, in this

TEST_CASE("Nesting")
{
    SECTION("A") {
        SECTION("1") SUCCEED();
        SECTION("2") SUCCEED();
    }
    SECTION("B") {
        SECTION("1") SUCCEED();
        SECTION("2") SUCCEED();
    }
    SECTION("C") {
        SECTION("1") SUCCEED();
        SECTION("2") SUCCEED();
    }
}

Only "C" is unaffected.

@horenmar horenmar added the Bug label Jun 28, 2019
@sfranzen
Copy link
Contributor Author

Thanks, that has given me somewhere more specific to look, and it looks like an easy fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants