I am a bit unclear on when the code in a TEST_CASE is run when there are nested SECTIONs. I can't find anything about the details in the documentation so I am not sure what the intended action is here and whether there is a bug or not.
Here is some example code:
TEST_CASE("run once with section") {
printf("a0\n");
SECTION("foo") {
printf("a1\n");
}
printf("a2\n");
}
TEST_CASE("run twice with and without section") {
int error = 0;
printf("b0\n");
try {
printf("b1\n");
SECTION("bar") {
printf("b2\n");
throw 1;
}
printf("b3\n");
} catch (int e) {
printf("b4\n");
error = e;
}
printf("b5\n");
REQUIRE(error > 0);
}
This prints out:
a0
a1
a2
b0
b1
b2
b4
b5
b0
b1
b3
b5
indicating that the first example was only run once, but the second was run twice, once without and once with the SECTION("bar") code.
See also #191.
I am a bit unclear on when the code in a TEST_CASE is run when there are nested SECTIONs. I can't find anything about the details in the documentation so I am not sure what the intended action is here and whether there is a bug or not.
Here is some example code:
This prints out:
indicating that the first example was only run once, but the second was run twice, once without and once with the
SECTION("bar")code.See also #191.