From ebe2ad4a4c6b29aa07987c80d5746e019a6ccf16 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sat, 22 Aug 2015 22:07:11 +0200 Subject: [PATCH] Add autotest for chomp Signed-off-by: Joachim Nilsson --- Makefile | 1 + chomp.c | 4 ++-- chomp.mk | 4 ++++ rsync.c | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 chomp.mk diff --git a/Makefile b/Makefile index e423c78..0e66e6d 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,7 @@ incdir ?= $(prefix)/include include rules.mk test: + $(MAKE) -f chomp.mk $(MAKE) -f rsync.mk $(OBJS): Makefile diff --git a/chomp.c b/chomp.c index 9f47511..905b45e 100644 --- a/chomp.c +++ b/chomp.c @@ -50,13 +50,13 @@ char *chomp(char *str) int main(void) { int i; char t[][16] = { "hej\ndej", "Slime\n\n\\n", "Tripple\n\n\n", "" }; - for (i = 0; t[i][0]; i++) printf("'%s'\n", chomp(t[i])); return 0; + for (i = 0; t[i][0]; i++) printf("[%02d]: '%s'\n", i, chomp(t[i])); return 0; } #endif /** * Local Variables: - * compile-command: "gcc -DUNITTEST -o chompy chomp.c && ./chompy" + * compile-command: "make V=1 -f chomp.mk" * version-control: t * indent-tabs-mode: t * c-file-style: "linux" diff --git a/chomp.mk b/chomp.mk new file mode 100644 index 0000000..22b1438 --- /dev/null +++ b/chomp.mk @@ -0,0 +1,4 @@ +OBJS = +TARGET = chomp.test clean + +include rules.mk diff --git a/rsync.c b/rsync.c index 6822921..23b7ed1 100644 --- a/rsync.c +++ b/rsync.c @@ -293,7 +293,7 @@ int main(int argc, char *argv[]) /** * Local Variables: - * compile-command: "make -f rsync.mk" + * compile-command: "make V=1 -f rsync.mk" * version-control: t * indent-tabs-mode: t * c-file-style: "linux"