diff --git a/src/unity.h b/src/unity.h index 9f8049533d63729598f99e711e12a94ac796b038..d9f41de60c2a146add4266e72fb58ce59862cccb 100644 --- a/src/unity.h +++ b/src/unity.h @@ -68,6 +68,10 @@ void tearDown(void); #define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL) #define TEST_ONLY() +//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) + //------------------------------------------------------- // Test Asserts (simple) //------------------------------------------------------- diff --git a/test/tests/testunity.c b/test/tests/testunity.c index c7d9af831c642eb41b30c1dad230d628dd2c9fff..13d7d14d5943f896cd3bc6fd600d80c94b64534c 100644 --- a/test/tests/testunity.c +++ b/test/tests/testunity.c @@ -110,6 +110,12 @@ void testUnitySizeInitializationReminder(void) TEST_ASSERT_EQUAL_MESSAGE(sizeof(_Expected_Unity), sizeof(Unity), message); } +void testPassShouldEndImmediatelyWithPass(void) +{ + TEST_PASS(); + TEST_FAIL_MESSAGE("We should have passed already and finished this test"); +} + void testTrue(void) { TEST_ASSERT(1);