You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However it is possible, under the incorrect use of REQUIRE, for this comparison to fail by nesting calls to REQUIRE.
Steps to reproduce
I couldn't see a nice way to write a test to demonstrate this, but here is a contrived example
namespaceMyTests {
booldoSomeRequirement() {
REQUIRE(false); // Clearly we should not nest REQUIRE but this is still validreturnfalse;
}
TEST_CASE("Session should abort after this test") {
REQUIRE(doSomeRequirement());
}
TEST_CASE("This test should not be executed") {
REQUIRE(false); // This is executed even though the first test fails
}
}
voidmain() {
Catch::ConfigData config;
config.abortAfter = 1; // I want to abort after a single assertion fails
Catch::Session session;
session.useConfigData(config);
session.run();
}
Extra information
Catch version: v2.4.0
Operating System: Windows 10
Compiler+version: 19.14.26433
The text was updated successfully, but these errors were encountered:
Anyway, I agree that nested REQUIREs are perfectly reasonable, even though they can cause some bugs (there is at least one more open, but that one is mostly cosmetic).
Description
The abort after value is tested for equality against total failed assertions here :
However it is possible, under the incorrect use of
REQUIRE
, for this comparison to fail by nesting calls toREQUIRE
.Steps to reproduce
I couldn't see a nice way to write a test to demonstrate this, but here is a contrived example
Extra information
The text was updated successfully, but these errors were encountered: