spec test index / oilshell.org
| case | bash | osh | description |
| 0 | pass | pass | var ref ${!a} |
| 1 | pass | FAIL | var ref: positional params |
| details | |||
| 2 | pass | FAIL | var ref with special vars |
| details | |||
| 3 | pass | FAIL | indirection, *then* fancy expansion features |
| details | |||
| 4 | pass | FAIL | indirection *to* an array reference |
| details | |||
| 5 | ok | pass | indirection to nasty complex array references |
| details | |||
| 6 | ok | pass | indirection *to* fancy expansion features bash disallows |
| details | |||
| 7 | pass | FAIL | declare -n and ${!a} |
| details | |||
| 8 | pass | FAIL | Bad var ref with ${!a} |
| details | |||
| 9 | pass | pass | ${!OPTIND} (used by bash completion |
12 passed, 2 ok, 0 known unimplemented, 0 known bugs, 6 failed, 0 skipped
| osh | 1 var ref: positional params [osh stdout] Expected '|x|\n|x|y|\n|x y|\n', got '|x|\n|x|y|\n|x|y|\n' stdout: |x| |x|y| |x|y|stderr: |
| osh | 2 var ref with special vars [osh stdout] Expected 'myfunc\n0\n', got 'myfunc\n' [osh status] Expected 0, got 1 stdout: myfuncstderr: echo ${!ref}
^~~
[ stdin ]:3: fatal: Bad indirect expansion: '?'
|
| osh | 3 indirection, *then* fancy expansion features [osh stdout] Expected 'ok\n', got '${!b[1]} -> expected asdf, got asdf x\n${!y:-foo} -> expected foo, got \n vs foo\n$zz -> expected foo, got \n vs foo\n$zz -> expected foo, got \nbad success: ${!w:?oops}\nbad err msg: ${!w:?oops} -> \n${!x:+foo} -> expected foo, got aaabcc\n${!x:2} -> expected abcc, got aaabcc\n${!x:2:2} -> expected ab, got aaabcc\n${!x#*a} -> expected aabcc, got aaabcc\n${!x%%c*} -> expected aaab, got aaabcc\n${!x/a*b/d} -> expected dcc, got aaabcc\n${!x^a} -> expected Aaabcc, got aaabcc\n${!p@P} -> expected $ , got \\$ \nok\n' stdout: ${!b[1]} -> expected asdf, got asdf x
${!y:-foo} -> expected foo, got
vs foo
$zz -> expected foo, got
vs foo
$zz -> expected foo, got
bad success: ${!w:?oops}
bad err msg: ${!w:?oops} ->
${!x:+foo} -> expected foo, got aaabcc
${!x:2} -> expected abcc, got aaabcc
${!x:2:2} -> expected ab, got aaabcc
${!x#*a} -> expected aabcc, got aaabcc
${!x%%c*} -> expected aaab, got aaabcc
${!x/a*b/d} -> expected dcc, got aaabcc
${!x^a} -> expected Aaabcc, got aaabcc
${!p@P} -> expected $ , got \$
ok
stderr: |
| osh | 4 indirection *to* an array reference [osh stdout] Expected '.\n.x\n.x.y\n.x y\n', got '.\n.x\n.x.y\n.x.y\n' stdout: . .x .x.y .x.ystderr: |
| bash | 5 indirection to nasty complex array references stdout: 1 7 8 9 10 11 endstderr: main: line 4: {1,0}: syntax error: operand expected (error token is "{1,0}")
main: line 4: <(echo x): syntax error: operand expected (error token is "<(echo x)")
main: line 4: 1 0: syntax error in expression (error token is "0")
main: line 4: b*: syntax error: operand expected (error token is "*")
main: line 4: a[1"]: bad substitution
|
| bash | 6 indirection *to* fancy expansion features bash disallows stdout: donestderr: main: line 2: a[0: bad substitution main: line 2: aa[k: bad substitution main: line 2: !x: bad substitution main: line 2: !a[0]: bad substitution main: line 2: x:-foo: bad substitution main: line 2: x:=foo: bad substitution main: line 2: x:?oops: bad substitution main: line 2: x:+yy: bad substitution main: line 2: x:0: bad substitution main: line 2: x:0:1: bad substitution main: line 2: !a@: bad substitution main: line 2: #x: bad substitution main: line 2: x#y: bad substitution main: line 2: x/y/foo: bad substitution main: line 2: x@Q: bad substitution |
| osh | 7 declare -n and ${!a} [osh stdout] Expected 'b c\n', got 'c b\n' stdout: c bstderr: |
| osh | 8 Bad var ref with ${!a} [osh stdout] Expected 'status=1\n', got '' [osh status] Expected 0, got 1 stdout: stderr: echo ref ${!a}
^
[ stdin ]:2: fatal: Bad indirect expansion: 'bad var name'
|