From 3a4b3fa01b6ead1e23434c533302a2a9fddfd89e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 22 Aug 2021 11:21:07 -0300 Subject: Have a single top-level main for running unit-tests Instead of each .c file becoming a self-standing .t executable file, and being run for executing the unit tests local to the file, now each .c becomes a .to object (akin to a .o object, but one where the -DTEST flag is given to the compiler). After that, all the .to objects are linked together in a gistatic-tests executable, in a equivalent way that all .o files get linked together in a gistatic executable. This change was necessary in order to allow dependencies between objects. The next task will be making a tar of a repository tree checkout, and src/gistatic.{o,to} will start depending on src/tar.{o,to}. If each file has its own main function when -DTEST is given, then I wont be able to link them together. I took the opportunity that I had to change the Makefile, and I improved the dependency between targets and dependencies greatly. From what I can tell now, it is correct. --- src/tar.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) (limited to 'src/tar.c') diff --git a/src/tar.c b/src/tar.c index 63aebe8..43a580c 100644 --- a/src/tar.c +++ b/src/tar.c @@ -1,36 +1,6 @@ #include "config.h" #include "tar.h" - #ifdef TEST - -#include "tests-lib.h" - -#include -#include -#include - -#endif - - -void a(void) { } - -#ifdef TEST -static void test_a(void) { - test_start("test_a:"); - { - testing("a"); - assert(true); - test_ok(); - } -} - -static void unit_tests(void) { - test_a(); -} - -int main(void) { - unit_tests(); - return EXIT_SUCCESS; -} +void unit_tests_tar(void) {} #endif -- cgit v1.2.3