mirror of
https://github.com/throwtheswitch/cexception.git
synced 2026-09-04 17:29:58 +00:00
* fixed error where fallback function was showing wrong ID
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@ void Throw(CEXCEPTION_T ExceptionID)
|
|||||||
{
|
{
|
||||||
longjmp(*CExceptionFrames[MY_ID].pFrame, 1);
|
longjmp(*CExceptionFrames[MY_ID].pFrame, 1);
|
||||||
}
|
}
|
||||||
CEXCEPTION_NO_CATCH_HANDLER(MY_ID);
|
CEXCEPTION_NO_CATCH_HANDLER(ExceptionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
|
|
||||||
extern volatile int TestingTheFallback;
|
extern volatile int TestingTheFallback;
|
||||||
|
extern volatile int TestingTheFallbackId;
|
||||||
|
|
||||||
//Optionally define the exception type (something like an int which can be directly assigned)
|
//Optionally define the exception type (something like an int which can be directly assigned)
|
||||||
#define CEXCEPTION_T int
|
#define CEXCEPTION_T int
|
||||||
@@ -20,6 +21,7 @@ extern volatile int TestingTheFallback;
|
|||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
|
TestingTheFallbackId = id; \
|
||||||
TestingTheFallback--; \
|
TestingTheFallback--; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "CException.h"
|
#include "CException.h"
|
||||||
|
|
||||||
volatile int TestingTheFallback;
|
volatile int TestingTheFallback;
|
||||||
|
volatile int TestingTheFallbackId;
|
||||||
|
|
||||||
void setUp(void)
|
void setUp(void)
|
||||||
{
|
{
|
||||||
@@ -314,6 +315,7 @@ void test_AThrowWithoutATryCatchWillUseDefaultHandlerIfSpecified(void)
|
|||||||
|
|
||||||
//We know the fallback was run because it decrements the counter above
|
//We know the fallback was run because it decrements the counter above
|
||||||
TEST_ASSERT_FALSE(TestingTheFallback);
|
TEST_ASSERT_FALSE(TestingTheFallback);
|
||||||
|
TEST_ASSERT_EQUAL(0xBE, TestingTheFallbackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_AThrowWithoutOutsideATryCatchWillUseDefaultHandlerEvenAfterTryCatch(void)
|
void test_AThrowWithoutOutsideATryCatchWillUseDefaultHandlerEvenAfterTryCatch(void)
|
||||||
@@ -336,4 +338,5 @@ void test_AThrowWithoutOutsideATryCatchWillUseDefaultHandlerEvenAfterTryCatch(vo
|
|||||||
|
|
||||||
//We know the fallback was run because it decrements the counter above
|
//We know the fallback was run because it decrements the counter above
|
||||||
TEST_ASSERT_FALSE(TestingTheFallback);
|
TEST_ASSERT_FALSE(TestingTheFallback);
|
||||||
|
TEST_ASSERT_EQUAL(0xBE, TestingTheFallbackId);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user