array-compat () { run-file array-compat "$@" } run-file () { local spec_name=$1; shift; sh-spec spec/$spec_name.test.sh --compare-shells --oils-bin-dir $PWD/bin "$@" }
spec test index / oilshell.org
status | bash | mksh | osh | |
pass | 12 | 9 | 7 | |
ok | 0 | 0 | 3 | |
N-I | 0 | 3 | 0 | |
FAIL | 0 | 0 | 2 | |
total | 12 | 12 | 12 | |
case | bash | mksh | osh | description |
0 | pass | pass | pass | Assignment Causes Array Decay |
1 | pass | pass | pass | Array Decay with IFS |
2 | pass | pass | pass | User arrays decay |
3 | pass | pass | ok | strict_array: $array is not valid in OSH, is ${array[0]} in ksh/bash |
details | ||||
4 | pass | pass | ok | strict_array: ${array} is not valid in OSH, is ${array[0]} in ksh/bash |
details | ||||
5 | pass | pass | pass | Assign to array index without initialization |
6 | pass | pass | pass | a[40] grows array |
7 | pass | pass | pass | array decays to string when comparing with [[ a = b ]] |
8 | pass | pass | ok | ++ on a whole array increments the first element (disallowed with strict_array) |
details | ||||
9 | pass | N-I | pass | Apply vectorized operations on ${a[*]} |
details | ||||
10 | pass | N-I | FAIL | value.BashArray internal representation - Indexed |
details | details | |||
11 | pass | N-I | FAIL | value.BashArray internal representation - Assoc (ordering is a problem) |
details | details |
28 passed, 3 OK, 3 not implemented, 0 BUG, 2 failed, 0 timeouts, 0 cases skipped 2 failed under osh
osh | 3 strict_array: $array is not valid in OSH, is ${array[0]} in ksh/bash stdout: stderr: echo $a ^~ [ stdin ]:4: fatal: Array 'a' can't be referred to as a scalar (without @ or *) |
osh | 4 strict_array: ${array} is not valid in OSH, is ${array[0]} in ksh/bash stdout: stderr: echo ${a} ^~ [ stdin ]:4: fatal: Array 'a' can't be referred to as a scalar (without @ or *) |
osh | 8 ++ on a whole array increments the first element (disallowed with strict_array) stdout: stderr: (( a++ )) # doesn't make sense ^ [ stdin ]:4: fatal: Expected a value convertible to integer, got BashArray |
mksh | 9 Apply vectorized operations on ${a[*]} stdout: stderr: mksh: <stdin>[3]: ${a[*]#-}: bad substitution |
mksh | 10 value.BashArray internal representation - Indexed stdout: stderr: |
osh | 10 value.BashArray internal representation - Indexed [osh stdout] Expected 'declare -a z=()\ndeclare -a z=([0]="b" [1]="c")\ndeclare -a z=([0]="b" [1]="c" [5]="d")\ndeclare -a z=([0]="b" [1]="ZZZ" [5]="d")\ndeclare -a z=([0]="b" [1]="ZZZ" [5]="d" [6]="f" [7]="g")\ndeclare -a z=([0]="b-mystr" [1]="ZZZ" [5]="d" [6]="f" [7]="g")\ndeclare -a z=([0]="b-mystr" [1]="ZZZ-append" [5]="d" [6]="f" [7]="g")\n[\'keys\', \'0\', \'1\', \'5\', \'6\', \'7\']\n[\'values\', \'b-mystr\', \'ZZZ-append\', \'d\', \'f\', \'g\']\nstatus=1\n' Got 'z=()\nz=(b c)\nz=(); z[0]=b z[1]=c z[5]=d\nz=(); z[0]=b z[1]=ZZZ z[5]=d\nz=(); z[0]=b z[1]=ZZZ z[5]=d z[6]=f z[7]=g\n' [osh status] Expected 0, got 1 stdout: z=() z=(b c) z=(); z[0]=b z[1]=c z[5]=d z=(); z[0]=b z[1]=ZZZ z[5]=d z=(); z[0]=b z[1]=ZZZ z[5]=d z[6]=f z[7]=gstderr: z+=-mystr ^~~ [ stdin ]:18: fatal: Can't append string to array |
mksh | 11 value.BashArray internal representation - Assoc (ordering is a problem) stdout: stderr: |
osh | 11 value.BashArray internal representation - Assoc (ordering is a problem) [osh stdout] Expected 'declare -A A=([k]="v" )\n[\'keys\', \'k\']\n[\'values\', \'v\']\n' Got "A=(['k']=v)\n['keys', 'k']\n['values', 'v']\n" stdout: A=(['k']=v) ['keys', 'k'] ['values', 'v']stderr: |