Fixed broken test

This commit is contained in:
2023-08-06 04:38:55 +10:00
parent f885fdaf4c
commit fb4258f9df
2 changed files with 7 additions and 12 deletions

View File

@@ -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";

View File

@@ -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;
}