summaryrefslogtreecommitdiff
path: root/src/codegen/codegen_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen/codegen_main.c')
-rw-r--r--src/codegen/codegen_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/codegen/codegen_main.c b/src/codegen/codegen_main.c
index 7363e61..61269ef 100644
--- a/src/codegen/codegen_main.c
+++ b/src/codegen/codegen_main.c
@@ -547,7 +547,7 @@ void codegen_node(ParserContext *ctx, ASTNode *node, FILE *out)
emit_lambda_defs(ctx, out);
- emit_tests_and_runner(ctx, kids, out);
+ int test_count = emit_tests_and_runner(ctx, kids, out);
ASTNode *iter = merged_funcs;
while (iter)
@@ -656,7 +656,7 @@ void codegen_node(ParserContext *ctx, ASTNode *node, FILE *out)
chk = chk->next;
}
- if (!has_user_main)
+ if (!has_user_main && test_count > 0)
{
fprintf(out, "\nint main() { _z_run_tests(); return 0; }\n");
}