diff --git a/src/unity.c b/src/unity.c index 299f304f..b241b6e0 100644 --- a/src/unity.c +++ b/src/unity.c @@ -1248,7 +1248,13 @@ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int if (TEST_PROTECT()) { setUp(); - Func(); + if (CATCH_TEST_FAIL()) { + UnityTestResultsFailBegin(42); + UnityAddMsgIfSpecified("TEST_FAIL called"); + UNITY_FAIL_AND_BAIL; + } else { + Func(); + } } if (TEST_PROTECT() && !(Unity.CurrentTestIgnored)) { diff --git a/src/unity.h b/src/unity.h index 018a85af..317510ba 100644 --- a/src/unity.h +++ b/src/unity.h @@ -287,6 +287,7 @@ extern jmp_buf __unity_exp_buf__; #define TEST_CATCH } else { #define TEST_ETRY } } while(0) #define TEST_THROW longjmp(__unity_exp_buf__, 1) +#define CATCH_TEST_FAIL() (setjmp(__unity_exp_buf__) != 0) // Refactor to make this easier to manage #define TEST_SHOULD_CATCH_ASSERT(actual) \