# error-y.sh: yash-specific test of error conditions test_O -d -e 2 'syntax error kills non-interactive shell' fi echo not reached __IN__ test_O -d -e 2 'syntax error in eval kills non-interactive shell' eval fi echo not reached __IN__ test_o -d 'syntax error in subshell' (eval fi; echo not reached) echo $? __IN__ 2 __OUT__ test_o -d 'syntax error spares interactive shell' -i +m fi echo $? __IN__ 2 __OUT__ test_o 'redirection error on compound command spares non-interactive shell' if echo not printed 1; then echo not printed 2; fi <_no_such_dir_/foo printf 'reached\n' __IN__ reached __OUT__ test_o 'redirection error on compound command in subshell' (if echo not printed 1; then echo not printed 2; fi <_no_such_dir_/foo [ \$? -ne 0 ]; printf 'reached %d\n' \$?) __IN__ reached 0 __OUT__ test_o 'redirection error on compound command spares interactive shell' -i +m if echo not printed 1; then echo not printed 2; fi <_no_such_dir_/foo printf 'reached\n' __IN__ reached __OUT__ test_o 'redirection error on function spares non-interactive shell' func() { echo not printed; } func <_no_such_dir_/foo printf 'reached\n' __IN__ reached __OUT__ test_o 'redirection error on function in subshell' func() { echo not printed; } (func <_no_such_dir_/foo; [ \$? -ne 0 ]; printf 'reached %d\n' \$?) __IN__ reached 0 __OUT__ test_o 'redirection error on function spares interactive shell' -i +m func() { echo not printed; } func <_no_such_dir_/foo printf 'reached\n' __IN__ reached __OUT__ test_O -d -e n 'expansion error kills non-interactive shell' unset a echo ${a?} echo not reached __IN__ test_o -d 'expansion error in subshell' unset a (echo ${a?}; echo not reached) echo $? __IN__ 2 __OUT__ test_o -d 'expansion error spares interactive shell' -i +m unset a echo ${a?} echo $? __IN__ 2 __OUT__ test_o -d 'command not found' ./_no_such_command_ echo $? __IN__ 127 __OUT__ : TODO not yet implemented <<'__IN__' test_O -d -e 2 'built-in short option argument missing' exec -a __IN__ : TODO not yet implemented <<'__IN__' test_O -d -e 2 'built-in long option argument missing' exec --a __IN__ test_O -d -e 2 'built-in short option hyphen' export -p- __IN__ test_O -d -e 2 'built-in invalid short option' export -pX # TODO exec -cXaY __IN__ : TODO not yet implemented <<'__IN__' test_O -d -e 2 'built-in invalid long option without argument' exec --no-such-option __IN__ : TODO not yet implemented <<'__IN__' test_O -d -e 2 'built-in invalid long option with argument' exec --no-such=option __IN__ : TODO not yet implemented <<'__IN__' test_O -d -e 2 'built-in unexpected option argument' exec --cle=X __IN__ : TODO not yet implemented <<'__IN__' test_O -e 2 'ambiguous long option, exit status and standard output' read --p X __IN__ : TODO not yet implemented <<'__OUT__' test_o 'ambiguous long option, standard error' read --p X 2>&1 | head -n 1 __IN__ read: option `--p' is ambiguous __OUT__ ############################################################################### # $1 = line no. # $2 = built-in name test_special_builtin_syntax() { testcase "$1" -d \ "argument syntax error on special built-in $2 kills non-interactive shell${posix:+" (POSIX)"}" \ 3<<__IN__ 4