# HG changeset patch # User David A. Holland # Date 1292839267 18000 # Node ID ac45dcc57ff977e0e128c296b6dc016ac0aa30dd # Parent 18681e5ae6e46cff9ebc31ad92c54f803b7538b6 add some simple tests diff -r 18681e5ae6e4 -r ac45dcc57ff9 .hgignore --- a/.hgignore Mon Dec 20 04:38:43 2010 -0500 +++ b/.hgignore Mon Dec 20 05:01:07 2010 -0500 @@ -1,2 +1,5 @@ ~$ ^obj$ + +^tests/.*\.run$ +^tests/.*\.diff$ diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/Makefile Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,33 @@ +TRADCPP=../obj/tradcpp # XXX + +TESTS=t01 t02 t03 t04 t05 t06 t07 + +all: run-tests .WAIT show-diffs + +.for T in $(TESTS) +run-tests: $(T).diff + +$(T).diff: $(T).run $(T).good $(TRADCPP) + -diff $(T).good $(T).run > $(T).diff + +$(T).run: $(TRADCPP) $(T).c + $(TRADCPP) $(T).c $(T).run +.endfor + +show-diffs: + @echo '*** Test diffs ***' +.for T in $(TESTS) + @cat $(T).diff +.endfor + +clean: +.for T in $(TESTS) + rm -f $(T).run $(T).diff +.endfor + +good: +.for T in $(TESTS) + cp $(T).run $(T).good +.endfor + +.PHONY: all run-tests show-diffs clean good diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t01.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t01.c Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,1 @@ +glop. diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t01.good --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t01.good Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,1 @@ +glop. diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t02.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t02.c Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,2 @@ +#define glop flop +glop diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t02.good --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t02.good Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,1 @@ +flop diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t03.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t03.c Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,2 @@ +#define glop(x) flop x +glop(boo) diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t03.good --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t03.good Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,1 @@ +flop boo diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t04.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t04.c Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,2 @@ +#define string(x) "x" +string(abc) diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t04.good --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t04.good Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,1 @@ +"abc" diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t05.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t05.c Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,2 @@ +#define concat(a, b) a/**/b +concat(abc, def) diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t05.good --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t05.good Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,1 @@ +abcdef diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t06.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t06.c Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,2 @@ +/*glop*/ + diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t06.good --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t06.good Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,1 @@ + diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t07.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t07.c Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,3 @@ +/* + * gloop + */ diff -r 18681e5ae6e4 -r ac45dcc57ff9 tests/t07.good --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t07.good Mon Dec 20 05:01:07 2010 -0500 @@ -0,0 +1,1 @@ +