Results for array.test.sh

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

Details on runs that didn't PASS

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

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

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

stdout:
1
stderr:
mksh11 array with invalid token

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

stdout:
['none', 'x', '']
stderr:
mksh48 Single array with :-

stdout:
['none', 'x', 'none']
stderr:
osh48 Single array with :-

stdout:
['x', '']
stderr:
osh_ALT48 Single array with :-

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

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

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

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

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

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

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

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

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

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

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

stdout:
stderr: 
mksh: <stdin>[4]: ${a[@]: 15:2}: bad substitution