doctest
doctest copied to clipboard
endless loop with multiple `DOCTEST_SUBCASE`s when an exception is thrown prior to any subcase
The following file causes an endless loop:
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest/doctest.h>
TEST_CASE("wtf")
{
static int cnt = 0;
if (cnt++ >= 1) {
throw std::runtime_error{"wat"};
}
DOCTEST_SUBCASE("1") {}
DOCTEST_SUBCASE("2") {}
}
The expected behavior is that this simply reports an unexpected exception, and terminates cleanly.
- doctest version: v2.4.11
- Operating System: NixOS
- Compiler+version: clang 16.0.1, GCC 12.2.0 (both produce the same results)
I've bisected this to eb8b04a2b1db23ea5665cd8b5cbe859beb0ef80d, hence ccing @Saalvage .
We started getting this in a real codebase where some common, boring setup code started accidentally throwing an exception on its second run.
I also experienced the same bug in the latest version! Please fix it!!!