Skip to content

Commit

Permalink
Fixed 2 test runner issues (rh-hideout#3076)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
AsparagusEduardo and mrgriffin committed Jun 26, 2023
1 parent 4a6f791 commit f3be4e1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/test_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f3be4e1

Please sign in to comment.