From 5449f1e4d1822c222dc21a9511db935bea4e765c Mon Sep 17 00:00:00 2001 From: jsalling <jsalling@users.noreply.github.com> Date: Sat, 14 Jan 2017 10:41:03 -0600 Subject: [PATCH] Condense all longjmp calls into TEST_ABORT() The setjmp calls are all in TEST_PROTECT() already --- src/unity.c | 4 ++-- src/unity.h | 2 +- src/unity_internals.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unity.c b/src/unity.c index 4c00f7e..8fb0b38 100644 --- a/src/unity.c +++ b/src/unity.c @@ -13,8 +13,8 @@ void UNITY_OUTPUT_CHAR(int); #endif /* Helpful macros for us to use here in Assert functions */ -#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); } -#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); } +#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; TEST_ABORT(); } +#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; TEST_ABORT(); } #define RETURN_IF_FAIL_OR_IGNORE if (Unity.CurrentTestFailed || Unity.CurrentTestIgnored) return struct UNITY_STORAGE_T Unity; diff --git a/src/unity.h b/src/unity.h index a544bb2..30d0e91 100644 --- a/src/unity.h +++ b/src/unity.h @@ -72,7 +72,7 @@ void tearDown(void); /* It is not necessary for you to call PASS. A PASS condition is assumed if nothing fails. * This method allows you to abort a test immediately with a PASS state, ignoring the remainder of the test. */ -#define TEST_PASS() longjmp(Unity.AbortFrame, 1) +#define TEST_PASS() TEST_ABORT() /*------------------------------------------------------- * Test Asserts (simple) diff --git a/src/unity_internals.h b/src/unity_internals.h index 2faea1a..e5cfe5e 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -536,7 +536,7 @@ extern const char UnityStrErr64[]; #define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0) -#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);} +#define TEST_ABORT() longjmp(Unity.AbortFrame, 1) /* This tricky series of macros gives us an optional line argument to treat it as RUN_TEST(func, num=__LINE__) */ #ifndef RUN_TEST