Fixed 2 test runner issues (#3076)

* Fixed 2 test runner issues

Thanks to MGriffin for the help
- Fixed non-battle tests omitting errors when failing.
- Fixed non-battle tests showing false positive memory leak errors due to the test failing for a different cause.

* Update test/test_runner.c

Co-authored-by: Martin Griffin <martinrgriffin@gmail.com>
This commit is contained in:
Eduardo Quezada D'Ottone 2023-06-26 14:26:42 -04:00 committed by GitHub
parent 4a6f791482
commit f3be4e1ac5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -155,7 +155,8 @@ void CB2_TestRunner(void)
if (gTestRunnerState.test->runner->tearDown)
gTestRunnerState.test->runner->tearDown(gTestRunnerState.test->data);
if (!gTestRunnerState.expectLeaks)
if (gTestRunnerState.result == gTestRunnerState.expectedResult
&& !gTestRunnerState.expectLeaks)
{
const struct MemBlock *head = HeapHead();
const struct MemBlock *block = head;
@ -372,10 +373,10 @@ void Test_ExitWithResult(enum TestResult result, const char *fmt, ...)
gTestRunnerState.result = result;
ReinitCallbacks();
if (gTestRunnerState.state == STATE_REPORT_RESULT
&& gTestRunnerState.test->runner->handleExitWithResult)
&& gTestRunnerState.result != gTestRunnerState.expectedResult)
{
if (!gTestRunnerState.test->runner->handleExitWithResult(gTestRunnerState.test->data, result)
&& gTestRunnerState.result != gTestRunnerState.expectedResult)
if (!gTestRunnerState.test->runner->handleExitWithResult
|| !gTestRunnerState.test->runner->handleExitWithResult(gTestRunnerState.test->data, result))
{
va_list va;
va_start(va, fmt);