array () { run-file array "$@" } run-file () { local spec_name=$1; shift; sh-spec spec/$spec_name.test.sh --compare-shells --oils-bin-dir $PWD/bin "$@" } array: spec test case results

Results for array.test.sh

statusbashmkshosh
pass 604165
ok 560
N-I 2150
BUG 160
FAIL 003
total686868
casebashmkshoshdescription
0pass BUG pass nounset / set -u with empty array (bug in bash 4.3, fixed in 4.4)
details
1pass BUG pass local array
details
2pass pass pass Command with with word splitting in array
3pass ok pass space before ( in array initialization
details
4pass pass pass array over multiple lines
5pass ok pass array with invalid token
details
6pass pass pass array with empty string
7pass pass pass Retrieve index
8pass pass pass Retrieve out of bounds index
9pass N-I pass Negative index
details
10pass BUG pass Negative index and sparse array
details
11pass BUG pass Negative index and sparse array
details
12pass BUG pass Length after unset
details
13pass pass pass Retrieve index that is a variable
14pass pass pass Retrieve index that is a variable without $
15pass pass pass Retrieve index that is a command sub
16pass pass pass Retrieve array indices with ${!a}
17pass pass pass Retrieve sparse array indices with ${!a}
18pass N-I pass ${!a[1]} is named ref in bash
details
19pass BUG pass ${!a} on array
details
20pass pass pass All elements unquoted
21pass pass pass All elements quoted
22pass pass pass $*
23pass pass pass "$*"
24pass pass pass Interpolate array into array
25pass pass pass Exporting array doesn't do anything, not even first element
26N-I N-I pass strict_array prevents exporting array
detailsdetails
27ok ok pass Arrays can't be used as env bindings
detailsdetails
28pass pass pass Set element
29pass pass pass Set element with var ref
30pass pass pass Set element with array ref
31BUG N-I pass Set array item to array
detailsdetails
32pass N-I pass Slice of array with [@]
details
33pass N-I pass Negative slice begin
details
34pass pass pass Negative slice length
35pass N-I pass Slice with arithmetic
details
36pass pass pass Number of elements
37pass pass pass Length of an element
38pass pass pass Iteration
39pass pass pass glob within array yields separate elements
40pass pass pass declare array and then append
41ok pass pass Array syntax in wrong place
details
42pass pass FAIL Single array with :-
details
43pass N-I pass Stripping a whole array unquoted
details
44pass N-I pass Stripping a whole array quoted
details
45ok ok pass Multiple subscripts not allowed
detailsdetails
46ok ok pass Length op, index op, then transform op is not allowed
detailsdetails
47pass pass pass ${mystr[@]} and ${mystr[*]} are no-ops
48N-I N-I pass ${mystr[@]} and ${mystr[*]} disallowed with strict_array
detailsdetails
49pass pass pass Create a "user" array out of the argv array
50pass pass pass Tilde expansion within array
51pass pass pass Brace Expansion within Array
52pass pass pass array default
53ok ok pass Singleton Array Copy and Assign. OSH can't index strings with ints
detailsdetails
54pass pass pass declare -a / local -a is empty array
55pass pass pass Create sparse array
56pass pass pass Create sparse array implicitly
57pass pass pass Append sparse arrays
58pass N-I pass Slice of sparse array with [@]
details
59pass pass pass Using an array itself as the index on LHS
60pass pass pass Using an array itself as the index on RHS
61pass pass pass a[$x$y] on LHS and RHS
62pass pass pass Dynamic parsing of LHS a[$code]=value
63pass pass pass Dynamic parsing of RHS ${a[$code]}
64pass N-I pass Is element set? test -v a[i]
details
65pass N-I pass [[ -v a[i] ]]
details
66pass N-I FAIL test -v a[i] with arith expressions
detailsdetails
67pass N-I FAIL More arith expressions in [[ -v array[expr]] ]]
detailsdetails
166 passed, 11 OK, 17 not implemented, 7 BUG, 3 failed, 0 timeouts, 0 cases skipped
3 failed under osh

Details on runs that didn't PASS

mksh0 nounset / set -u with empty array (bug in bash 4.3, fixed in 4.4)

stdout:
stderr: 
mksh: <stdin>[3]: empty[@]: parameter not set
mksh1 local array

stdout:
stderr: 
mksh: <stdin>[2]: syntax error: '(' unexpected
mksh3 space before ( in array initialization

stdout:
1
stderr:
mksh5 array with invalid token

stdout:
stderr: 
mksh: <stdin>[3]: syntax error: '&' unexpected
mksh9 Negative index

stdout:
['', '', '']
stderr:
mksh10 Negative index and sparse array

stdout:
0 2 3
-1
-2
-3
-4
-5
0 2 3 0
0 2 3 42
stderr:
mksh11 Negative index and sparse array

stdout:
0 0
1 1
2 2
3 3
stderr:
mksh12 Length after unset

stdout:
len=4
len=4
stderr:
mksh18 ${!a[1]} is named ref in bash

stdout:
['a[1]']
stderr:
mksh19 ${!a} on array

stdout:
['a']
stderr:
bash26 strict_array prevents exporting array

stdout:
None
stderr:
bash: line 1: shopt: strict_array: invalid shell option name
mksh26 strict_array prevents exporting array

stdout:
None
stderr:
mksh: <stdin>[1]: shopt: not found
bash27 Arrays can't be used as env bindings

stdout:
a
(b b)
stderr:
mksh27 Arrays can't be used as env bindings

stdout:
stderr: 
mksh: <stdin>[1]: syntax error: '(' unexpected
bash31 Set array item to array

stdout:
status=1
stderr:
bash: line 2: a[0]: cannot assign list to array member
mksh31 Set array item to array

stdout:
stderr: 
mksh: <stdin>[2]: set: a[0]: is not an identifier
mksh32 Slice of array with [@]

stdout:
stderr: 
mksh: <stdin>[2]: ${a[@]: 1:2}: bad substitution
mksh33 Negative slice begin

stdout:
stderr: 
mksh: <stdin>[2]: ${a[@]: (-4)}: bad substitution
mksh35 Slice with arithmetic

stdout:
stderr: 
mksh: <stdin>[3]: ${a[@]:i-4:2}: bad substitution
bash41 Array syntax in wrong place

stdout:
stderr: 
bash: line 1: syntax error near unexpected token `('
bash: line 1: `ls foo=(1 2)'
osh42 Single array with :-

[osh stdout] Expected "['none', 'x', 'none']\n", got "['x', '']\n"

stdout:
['x', '']
stderr:
mksh43 Stripping a whole array unquoted

stdout:
stderr: 
mksh: <stdin>[2]: ${files[@]%.c}: bad substitution
mksh44 Stripping a whole array quoted

stdout:
stderr: 
mksh: <stdin>[2]: ${files[@]%.c}: bad substitution
bash45 Multiple subscripts not allowed

stdout:
stderr: 
bash: line 2: ${a[0][0]}: bad substitution
mksh45 Multiple subscripts not allowed

stdout:
stderr: 
mksh: <stdin>[2]: ${a[0][0]}: bad substitution
bash46 Length op, index op, then transform op is not allowed

stdout:
stderr: 
bash: line 2: ${#a[0]/1/xxx}: bad substitution
mksh46 Length op, index op, then transform op is not allowed

stdout:
stderr: 
mksh: <stdin>[2]: ${#a[0]/1/xxx}: bad substitution
bash48 ${mystr[@]} and ${mystr[*]} disallowed with strict_array

stdout:
abc
status=0
abc
status=0
stderr:
bash: line 1: shopt: strict_array: invalid shell option name
bash: line 1: shopt: strict_array: invalid shell option name
mksh48 ${mystr[@]} and ${mystr[*]} disallowed with strict_array

stdout:
abc
status=0
abc
status=0
stderr:
mksh: shopt: not found
mksh: shopt: not found
bash53 Singleton Array Copy and Assign. OSH can't index strings with ints

stdout:
4 4
1 1
4 4
1 1
stderr:
mksh53 Singleton Array Copy and Assign. OSH can't index strings with ints

stdout:
4 4
1 1
4 4
1 1
stderr:
mksh58 Slice of sparse array with [@]

stdout:
stderr: 
mksh: <stdin>[4]: ${a[@]: 15:2}: bad substitution
mksh64 Is element set? test -v a[i]

stdout:
set=2
empty=2
unset=2
stderr:
mksh: <stdin>[3]: test: array[1]: unexpected operator/operand
mksh: <stdin>[6]: test: array[3]: unexpected operator/operand
mksh: <stdin>[9]: test: array[4]: unexpected operator/operand
mksh65 [[ -v a[i] ]]

stdout:
stderr: 
mksh: <stdin>[2]: syntax error: 'array[1]' unexpected operator/operand
mksh66 test -v a[i] with arith expressions

stdout:
status=2
status=2

dbracket
stderr:
mksh: <stdin>[3]: test: array[1+1]: unexpected operator/operand
mksh: <stdin>[6]: test: array[4+1]: unexpected operator/operand
mksh: <stdin>[12]: syntax error: 'array[1+1]' unexpected operator/operand
osh66 test -v a[i] with arith expressions

[osh stdout] Expected 'status=0\nstatus=1\n\ndbracket\nstatus=0\nstatus=1\n' Got 'status=1\nstatus=1\n\ndbracket\nstatus=1\nstatus=1\n'

stdout:
status=1
status=1

dbracket
status=1
status=1
stderr:
mksh67 More arith expressions in [[ -v array[expr]] ]]

stdout:
stderr: 
mksh: <stdin>[6]: syntax error: 'array[zero+0]' unexpected operator/operand
osh67 More arith expressions in [[ -v array[expr]] ]]

[osh stdout] Expected 'zero=0\none=0\ntwo=1\n---\nzero=0\none=0\ntwo=1\n---\nzero=0\none=0\ntwo=1\n' Got 'zero=1\none=1\ntwo=1\n---\nzero=1\none=1\ntwo=1\n---\nzero=1\none=1\ntwo=1\n'

stdout:
zero=1
one=1
two=1
---
zero=1
one=1
two=1
---
zero=1
one=1
two=1
stderr: