diff options
author | pommicket <pommicket@gmail.com> | 2025-09-15 13:52:32 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2025-09-15 13:52:32 -0400 |
commit | ee88497b4451225c3140f56d98ebcbc166175407 (patch) | |
tree | 39cd720c4840c2872fb065088b91658ef6d8d3d1 /tests/main.c | |
parent | 969bf523b7039c7038b66edde5776278c27941ac (diff) |
Errors tests; fix some non-errors
Diffstat (limited to 'tests/main.c')
-rw-r--r-- | tests/main.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/main.c b/tests/main.c index 7b791cd..ff68df3 100644 --- a/tests/main.c +++ b/tests/main.c @@ -2,6 +2,8 @@ #include <stdarg.h> #include <stdio.h> +#include <string.h> +#include <stdlib.h> static bool any_failure = false; @@ -15,12 +17,19 @@ void test_fail(const char *fmt, ...) { fprintf(stderr, "\n"); } -int main(void) { - const char *test_dir = "../tests"; +int main(int argc, char **argv) { + if (argc > 2 || (argc == 2 && strcmp(argv[1], "--help") == 0)) { + printf("usage: tests [TEST DIRECTORY]\n"); + return EXIT_FAILURE; + } + const char *test_dir = argc == 2 ? argv[1] : "../tests"; test_parsing(test_dir); + test_errors(test_dir); if (any_failure) { fprintf(stderr, "\x1b[1m\x1b[91mSome tests failed.\x1b[0m\n"); + return EXIT_FAILURE; } else { printf("\x1b[1m\x1b[92mAll tests OK\x1b[0m\n"); + return 0; } } |