Testing: count failures independently of assertion retention (X-QA-02)

This commit is contained in:
faumaray committed 2026-12-03 16:41:16 +03:00
1 parent 62c2082fb3
commit 430deab07a
4 files changed
+36 -6

No files matched your search

+8 -6
View File
@@ -115,6 +115,12 @@ namespace Void::Testing
return false;
}
}
// Failures are counted when recorded (TestResult::failed_assertions),
// independently of the bounded assertion vector kept for reporting.
[[nodiscard]] bool has_recorded_failure(const TestResult& result) noexcept
{
return result.failed_assertions > 0;
}
} // namespace
RunConfig Runner::parse_args(int argc, char** argv)
@@ -325,9 +331,7 @@ namespace Void::Testing
if (result.state != TestState::Skipped &&
result.state != TestState::Crashed) {
bool any = std::any_of(
result.assertions.begin(), result.assertions.end(),
[](const auto& a) { return !a.passed; });
const bool any = has_recorded_failure(result);
// An exception that escaped the body fails it too, with no failed
// assertion recorded.
const bool unhandled = !result.crash_info.empty() || !result.cleanup_error.empty();
@@ -376,9 +380,7 @@ namespace Void::Testing
if (result.state != TestState::Skipped &&
result.state != TestState::Crashed) {
bool any = std::any_of(
result.assertions.begin(), result.assertions.end(),
[](const auto& a) { return !a.passed; });
const bool any = has_recorded_failure(result);
// An exception that escaped the body fails it too, with no failed
// assertion recorded.
const bool unhandled = !result.crash_info.empty() || !result.cleanup_error.empty();