1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 00:15:58 +01:00

Merge pull request #695 from fkjagodzinski/dev/add-user-defined-protect-and-abort

Allow user-defined TEST_PROTECT & TEST_ABORT macros
This commit is contained in:
Mark VanderVoord
2023-09-19 07:37:15 -04:00
committed by GitHub
2 changed files with 75 additions and 1 deletions

View File

@@ -759,13 +759,25 @@ extern const char UnityStrErrShorthand[];
* Test Running Macros
*-------------------------------------------------------*/
#ifdef UNITY_TEST_PROTECT
#define TEST_PROTECT() UNITY_TEST_PROTECT()
#else
#ifndef UNITY_EXCLUDE_SETJMP_H
#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0)
#define TEST_ABORT() longjmp(Unity.AbortFrame, 1)
#else
#define TEST_PROTECT() 1
#endif
#endif
#ifdef UNITY_TEST_ABORT
#define TEST_ABORT() UNITY_TEST_ABORT()
#else
#ifndef UNITY_EXCLUDE_SETJMP_H
#define TEST_ABORT() longjmp(Unity.AbortFrame, 1)
#else
#define TEST_ABORT() return
#endif
#endif
/* Automatically enable variadic macros support, if it not enabled before */
#ifndef UNITY_SUPPORT_VARIADIC_MACROS