In both cases, the unhandled exception "bad 2" will be reported with the capture/section information of "bad 1".
This will only occur if no snitch macro is encountered between the two throw. So, for example, the following works again as expected:
try {
int i = 1;
CAPTURE(i);
throw std::runtime_error("bad 1");
} catch (...) {
}
// If there is a capture...
int j = 2;
CAPTURE(j);
// ... or a check
CHECK(1 == 2);
// ... or a section
SECTION("subsection 1") { /* ... */ }
// ... then the reported information will be accurate again for unhandled exceptions.
throw std::runtime_error("bad 2");
This is a bit of a niche edge case, but following changes in https://github.com/snitch-org/snitch/pull/178, the following doesn't behave as expected:
For captures:
For sections:
In both cases, the unhandled exception "bad 2" will be reported with the capture/section information of "bad 1".
This will only occur if no snitch macro is encountered between the two
throw
. So, for example, the following works again as expected: