summaryrefslogtreecommitdiff
path: root/asl
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2025-06-17 00:23:38 +0200
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2025-06-18 00:05:33 +0200
commit8f59f113e89a834aeef6842b4d9956d0fa608c83 (patch)
tree6bfa0bbec2c8b35d81569413a17da7df83babaca /asl
parentafb237c513854699ee4109dc117e6b58ae645bb8 (diff)
Fix test execution after a failHEADmain
Diffstat (limited to 'asl')
-rw-r--r--asl/testing/testing.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/asl/testing/testing.cpp b/asl/testing/testing.cpp
index 53e2bb0..45035d3 100644
--- a/asl/testing/testing.cpp
+++ b/asl/testing/testing.cpp
@@ -69,7 +69,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
asl::testing::Test* failed_head = nullptr;
- for (auto* it = g_state.head; it != nullptr; it = it->m_next)
+ for (auto* it = g_state.head; it != nullptr;)
{
asl::eprint(GREEN("[ RUN ]") " {}\n", it->m_case_name);
@@ -80,13 +80,17 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
{
asl::eprint(GREEN("[ OK ]") " {}\n", it->m_case_name);
pass += 1;
+ it = it->m_next;
}
else
{
asl::eprint(RED("[ FAILED ]") " {}\n", it->m_case_name);
fail += 1;
- it->m_next = asl::exchange(failed_head, it);
+ auto* this_test = it;
+ it = it->m_next;
+
+ this_test->m_next = asl::exchange(failed_head, this_test);
}
}