collapseos/tools/tests/zasm/errtests.sh

28 lines
470 B
Bash
Raw Normal View History

#!/bin/sh
# no "set -e" because we test errors
ZASM=../../emul/zasm/zasm
chkerr() {
echo "Check that '$1' results in error $2"
${ZASM} <<< $1 > /dev/null
local res=$?
if [[ $res == $2 ]]; then
echo "Good!"
else
echo "$res != $2"
exit 1
fi
}
chkerr "foo" 1
2019-05-27 11:22:38 -04:00
chkerr "ld a, foo" 2
2019-05-27 12:05:42 -04:00
chkerr "ld a, hl" 2
chkerr ".db foo" 2
2019-05-27 11:58:12 -04:00
chkerr "ld a," 3
chkerr "ld a, 'A" 3
chkerr ".db 0x42," 3
2019-05-27 12:12:21 -04:00
chkerr "ld a, 0x100" 4
chkerr ".db 0x100" 4