From c4376341e78528ca6504956413a0c750e076f433 Mon Sep 17 00:00:00 2001 From: ml-physec <206103694+ml-physec@users.noreply.github.com> Date: Mon, 20 Jul 2026 15:33:22 +0200 Subject: [PATCH] Clear detail stack in every situation --- auto/run_test.erb | 4 ++++ src/unity.c | 6 +++++- src/unity_internals.h | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/auto/run_test.erb b/auto/run_test.erb index e334d6570..40672b67f 100644 --- a/auto/run_test.erb +++ b/auto/run_test.erb @@ -8,7 +8,11 @@ static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE l return; #endif Unity.NumberOfTests++; +#ifdef UNITY_DETAIL_STACK_SIZE + Unity.CurrentDetailStackSize = 0; +#else UNITY_CLR_DETAILS(); +#endif UNITY_EXEC_TIME_START(); CMock_Init(); if (TEST_PROTECT()) diff --git a/src/unity.c b/src/unity.c index d8a8dd35f..69ee3b384 100644 --- a/src/unity.c +++ b/src/unity.c @@ -2527,8 +2527,12 @@ void UnityBegin(const char* filename) Unity.TestIgnores = 0; Unity.CurrentTestFailed = 0; Unity.CurrentTestIgnored = 0; - +#ifdef UNITY_DETAIL_STACK_SIZE + Unity.CurrentDetailStackSize = 0; +#else UNITY_CLR_DETAILS(); +#endif + UNITY_OUTPUT_START(); } diff --git a/src/unity_internals.h b/src/unity_internals.h index 67e994630..d5f90c55e 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -1318,8 +1318,8 @@ int UnityTestMatches(void); #define UNITY_DETAIL_PUSH(label, value) UnityPushDetail((UNITY_DETAIL_LABEL_TYPE)(label), (UNITY_DETAIL_VALUE_TYPE)(value), __LINE__) #define UNITY_DETAIL_POP(label, value) UnityPopDetail((UNITY_DETAIL_LABEL_TYPE)(label), (UNITY_DETAIL_VALUE_TYPE)(value), __LINE__) #else -#define UNITY_DETAIL_PUSH(label, value) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDetailStack) -#define UNITY_DETAIL_POP(label, value) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDetailStack) +#define UNITY_DETAIL_PUSH(label, value) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(__LINE__), UnityStrErrDetailStack) +#define UNITY_DETAIL_POP(label, value) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(__LINE__), UnityStrErrDetailStack) #endif /* End of UNITY_INTERNALS_H */