Fix crashes when arguments aren't provided to options that expect them. Detect when an option might have been forgotten. Add some tests for required option arguments.

This commit is contained in:
Toby Thain
2015-02-03 22:07:58 -05:00
parent e0dcdd467d
commit 6c388dcf54
2 changed files with 57 additions and 12 deletions

View File

@@ -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"