diff --git a/Makefile b/Makefile index 4bbad99..982ca8d 100644 --- a/Makefile +++ b/Makefile @@ -40,8 +40,24 @@ rad50.o: rad50.c rad50.h dumpobj.o: dumpobj.c rad50.h util.h rad50.o: rad50.c rad50.h -# Since the only test we have so far is for a crash bug, +# Since the only tests we have so far are for crashes, # just try to assemble. Later, we will need expected/actual tests. -tests: macro11 - ./macro11 tests/* +# Test that all options requiring a value bail out if it's not present. +argtests: macro11 + @ for OPT in -e -d -m -p -o -l -ysl ; do \ + ./macro11 foo.mac $$OPT 2> /dev/null; \ + if (( $$? == 1 )); then echo PASS; else echo FAIL; fi; \ + echo " $$OPT missing value"; \ + ./macro11 foo.mac $$OPT -v 2> /dev/null; \ + if (( $$? == 1 )); then echo PASS; else echo FAIL; fi; \ + echo " $$OPT fol. by option"; \ + done + @ ./macro11 foo.mac $$OPT -x -v 2> /dev/null; \ + if (( $$? == 1 )); then echo PASS; else echo FAIL; fi; \ + echo " -x must be the last option" + +tests: macro11 argtests + @ ACTUAL=`./macro11 tests/test-undef.mac 2>&1`; \ + if [ "tests/test-undef.mac:1: ***ERROR MACRO .TTYOU not found" == "$$ACTUAL" ]; then echo PASS; else echo FAIL; fi; \ + echo " test-undef.mac" diff --git a/macro11.c b/macro11.c index 9fa83ce..30bf8f7 100644 --- a/macro11.c +++ b/macro11.c @@ -108,7 +108,7 @@ static void print_help( printf("-e enable