Merge pull request #250 from jsalling/feature/optional-setjmp

Optional UNITY_EXCLUDE_SETJMP_H, different control flow
This commit is contained in:
Mark VanderVoord
2017-01-18 09:00:23 -05:00
committed by GitHub
4 changed files with 42 additions and 25 deletions

View File

@ -11,7 +11,9 @@
#include "unity_config.h"
#endif
#ifndef UNITY_EXCLUDE_SETJMP_H
#include <setjmp.h>
#endif
#ifndef UNITY_EXCLUDE_MATH_H
#include <math.h>
@ -374,7 +376,9 @@ struct UNITY_STORAGE_T
UNITY_COUNTER_TYPE TestIgnores;
UNITY_COUNTER_TYPE CurrentTestFailed;
UNITY_COUNTER_TYPE CurrentTestIgnored;
#ifndef UNITY_EXCLUDE_SETJMP_H
jmp_buf AbortFrame;
#endif
};
extern struct UNITY_STORAGE_T Unity;
@ -537,9 +541,13 @@ extern const char UnityStrErr64[];
* Test Running Macros
*-------------------------------------------------------*/
#ifndef UNITY_EXCLUDE_SETJMP_H
#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0)
#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);}
#define TEST_ABORT() longjmp(Unity.AbortFrame, 1)
#else
#define TEST_PROTECT() 1
#define TEST_ABORT() return
#endif
/* This tricky series of macros gives us an optional line argument to treat it as RUN_TEST(func, num=__LINE__) */
#ifndef RUN_TEST