diff --git a/tests/.gitignore b/tests/.gitignore index 5f5670d..e5fbc6e 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,4 +1,5 @@ *.log *.trs -pidfile makepath +pidfile +tree diff --git a/tests/Makefile.am b/tests/Makefile.am index 0d4445c..8f92186 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,8 +2,9 @@ EXTRA_DIST = check.h CLEANFILES = *~ *.trs *.log TESTS = -TESTS += pidfile TESTS += makepath +TESTS += pidfile +TESTS += tree check_PROGRAMS = $(TESTS) diff --git a/tests/tree.c b/tests/tree.c new file mode 100644 index 0000000..35ef9cb --- /dev/null +++ b/tests/tree.c @@ -0,0 +1,19 @@ +#include "check.h" + +int main(void) +{ + int result = 0; + size_t i; + struct { char *path; int fail; } arr[] = { + { "/etc/passwd", -1 }, + { "/dev", 0 }, + { "/sbin", 0 }, + }; + + for (i = 0; i < NELEMS(arr); i++) { + if (tree(arr[i].path, 1) != arr[i].fail) + result++; + } + + return result; +} diff --git a/tree.c b/tree.c index 761bff9..ddc93fc 100644 --- a/tree.c +++ b/tree.c @@ -120,30 +120,8 @@ int tree(char *path, int show_perms) return descend(path, show_perms, ""); } -#ifdef UNITTEST -#include "lite.h" - -int main(void) -{ - int i, result = 0; - struct { char *path; int fail; } arr[] = { - { "/etc/passwd", -1 }, - { "/dev", 0 }, - { "/sbin", 0 }, - }; - - for (i = 0; i < NELEMS(arr); i++) { - if (tree(arr[i].path, 1) != arr[i].fail) - result++; - } - - return result; -} -#endif - /** * Local Variables: - * compile-command: "make V=1 -f tree.mk" * indent-tabs-mode: t * c-file-style: "linux" * End: