From fb4258f9df7c3b857a012de96612676e34160d97 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Sun, 6 Aug 2023 04:38:55 +1000 Subject: [PATCH] Fixed broken test --- test/scripts/short-circuiting-support.toy | 9 --------- test/test_interpreter.c | 10 +++++++--- 2 files changed, 7 insertions(+), 12 deletions(-) delete mode 100644 test/scripts/short-circuiting-support.toy diff --git a/test/scripts/short-circuiting-support.toy b/test/scripts/short-circuiting-support.toy deleted file mode 100644 index 5e5bb17..0000000 --- a/test/scripts/short-circuiting-support.toy +++ /dev/null @@ -1,9 +0,0 @@ -//explicitly support && and || short circuits - -assert 1 && 2 == 2, "&& short-circuit failed"; - -assert 1 || 2 == 1, "|| short-circuit failed"; - - -print "All good"; - diff --git a/test/test_interpreter.c b/test/test_interpreter.c index 59d7510..0f6537d 100644 --- a/test/test_interpreter.c +++ b/test/test_interpreter.c @@ -18,6 +18,7 @@ static void noPrintFn(const char* output) { //NO OP } +int failedAssertions = 0; int ignoredAssertions = 0; static void noAssertFn(const char* output) { if (strncmp(output, "!ignore", 7) == 0) { @@ -27,6 +28,7 @@ static void noAssertFn(const char* output) { fprintf(stderr, TOY_CC_ERROR "Assertion failure: "); fprintf(stderr, "%s", output); fprintf(stderr, "\n" TOY_CC_RESET); //default new line + failedAssertions++; } } @@ -139,7 +141,6 @@ int main() { "polyfill-insert.toy", "polyfill-remove.toy", "short-circuit.toy", - "short-circuiting-support.toy", "ternary-expressions.toy", "trailing-comma-bugfix.toy", "types.toy", @@ -162,7 +163,10 @@ int main() { return -1; } - printf(TOY_CC_NOTICE "All good\n" TOY_CC_RESET); - return 0; + if (failedAssertions == 0) { + printf(TOY_CC_NOTICE "All good\n" TOY_CC_RESET); + } + + return failedAssertions; }