OILS / spec / explore-parsing.test.sh View on Github | oilshell.org

42 lines, 13 significant
1#
2# Tests that explore parsing corner cases.
3
4#### Length of length of ARGS!
5fun() { echo ${##}; }
6fun 0 1 2 3 4 5 6 7 8
7## stdout: 1
8
9#### Length of length of ARGS! 2 digit
10fun() { echo ${##}; }
11fun 0 1 2 3 4 5 6 7 8 9
12## stdout: 2
13
14#### Is \r considered whitespace?
15echo -e 'echo\rTEST' > myscript
16$SH myscript
17
18## status: 127
19## STDOUT:
20## END
21
22#### readonly +
23
24# dash and bash validate this! But not set +
25
26readonly + >/dev/null
27echo status=$?
28## STDOUT:
29status=0
30## END
31## OK bash STDOUT:
32status=1
33## END
34## OK dash status: 2
35## OK dash stdout-json: ""
36
37#### set +
38set + >/dev/null
39echo status=$?
40## STDOUT:
41status=0
42## END