From 5464e9fa35358c67c5afdced8ef569801098e46b Mon Sep 17 00:00:00 2001 From: faumaray Date: Tue, 27 Oct 2026 17:31:09 +0300 Subject: [PATCH] Testing: an exception that escapes a test fails it execute_test and execute_test_parallel set Failed when the body threw, then recomputed the state from the recorded assertions alone, so a test whose body threw before any failed assertion was reported as passed. The state now stays Failed when an unhandled exception was recorded. Found by a Void Engine test that threw on its first line and passed; it hid two failing engine tests. Co-Authored-By: Claude Opus 5.5 --- src/Testing/Runner.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Testing/Runner.cpp b/src/Testing/Runner.cpp index 2714409..da386a0 100644 --- a/src/Testing/Runner.cpp +++ b/src/Testing/Runner.cpp @@ -221,7 +221,11 @@ namespace Void::Testing bool any = std::any_of( result.assertions.begin(), result.assertions.end(), [](const auto& a) { return !a.passed; }); - result.state = any ? TestState::Failed : TestState::Passed; + // An exception that escaped the body fails it too, with no failed + // assertion recorded. + const bool unhandled = !result.crash_info.empty(); + result.state = + any || unhandled ? TestState::Failed : TestState::Passed; } return result; } @@ -268,7 +272,11 @@ namespace Void::Testing bool any = std::any_of( result.assertions.begin(), result.assertions.end(), [](const auto& a) { return !a.passed; }); - result.state = any ? TestState::Failed : TestState::Passed; + // An exception that escaped the body fails it too, with no failed + // assertion recorded. + const bool unhandled = !result.crash_info.empty(); + result.state = + any || unhandled ? TestState::Failed : TestState::Passed; } return result; }