From b1c6bbf59333466cf80fcce8b11f60a0e2f89616 Mon Sep 17 00:00:00 2001 From: Ryan Jensen Date: Fri, 27 Sep 2024 16:04:38 -0500 Subject: [PATCH] Disable printing tests that PASS --- src/unity.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/unity.c b/src/unity.c index 04d716d7..3a38cc5f 100644 --- a/src/unity.c +++ b/src/unity.c @@ -545,25 +545,33 @@ static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line) /*-----------------------------------------------*/ void UnityConcludeTest(void) { + bool printed_a_line = true; if (Unity.CurrentTestIgnored) { Unity.TestIgnores++; } - else if (!Unity.CurrentTestFailed) + else if (Unity.CurrentTestFailed) { - UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); - UnityPrint(UnityStrPass); + Unity.TestFailures++; } else { - Unity.TestFailures++; +#ifdef UNITY_SUPPRESS_RESULT_SUCCESS + printed_a_line = false; +#else + UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber); + UnityPrint(UnityStrPass); +#endif } Unity.CurrentTestFailed = 0; Unity.CurrentTestIgnored = 0; - UNITY_PRINT_EXEC_TIME(); - UNITY_PRINT_EOL(); - UNITY_FLUSH_CALL(); + + if (printed_a_line) { + UNITY_PRINT_EXEC_TIME(); + UNITY_PRINT_EOL(); + UNITY_FLUSH_CALL(); + } } /*-----------------------------------------------*/