OILS / spec / arg-parse.test.sh View on Github | oils.pub

50 lines, 14 significant
1## compare_shells: bash dash mksh zsh ash
2## oils_failures_allowed: 0
3
4# TODO:
5# - go through all of compgen -A builtin - which ones allow extra args?
6# - cd builtin should be strict
7
8#### true extra
9true extra
10## STDOUT:
11## END
12
13#### shift 1 extra
14$SH -c '
15set -- a b c
16shift 1 extra
17'
18if test $? -eq 0; then
19 echo fail
20fi
21
22## STDOUT:
23## END
24## BUG dash/mksh/zsh/ash STDOUT:
25fail
26## END
27
28#### continue 1 extra, break, etc.
29$SH -c '
30for i in foo; do
31 continue 1 extra
32done
33echo status=$?
34'
35if test $? -eq 0; then
36 echo fail
37fi
38
39## STDOUT:
40## END
41
42## BUG dash/ash/mksh STDOUT:
43status=0
44fail
45## END
46
47## BUG-2 zsh STDOUT:
48status=1
49fail
50## END