snitch-org / snitch

Lightweight C++20 testing framework.
Boost Software License 1.0
257 stars 7 forks source link

Nested sections don't always execute #83

Closed cschreib closed 1 year ago

cschreib commented 1 year ago
TEST_CASE("sections") {
    SECTION("section 1") {
        SECTION("section 1.1") {
            SECTION("section 1.1.1") {
                FAIL_CHECK("trigger");
            }
            SECTION("section 1.1.2") {
                FAIL_CHECK("trigger");
            }
            SECTION("section 1.1.3") {
                FAIL_CHECK("trigger");
            }
        }
        SECTION("section 1.2") {
            SECTION("section 1.2.1") {
                FAIL_CHECK("trigger");
            }
            SECTION("section 1.2.2") {
                FAIL_CHECK("trigger");
            }
            SECTION("section 1.2.3") {
                FAIL_CHECK("trigger");
            }
        }
    }
    SECTION("section 2") {
        SECTION("section 2.1") {
            SECTION("section 2.1.1") {
                FAIL_CHECK("trigger");
            }
            SECTION("section 2.1.2") {
                FAIL_CHECK("trigger");
            }
            SECTION("section 2.1.3") {
                FAIL_CHECK("trigger");
            }
        }
    }
}

snitch v1.0.0 silently misses:

Essentially, the last section at any level is only ever entered once, even if it has multiple child sections.