Results for array.test.sh

statusbashmkshosh
pass 594163
ok 560
N-I 2140
BUG 160
FAIL 004
total676767
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 FAIL Is element set? test -v a[i]
detailsdetails
65pass N-I FAIL [[ -v a[i] ]]
detailsdetails
66pass N-I FAIL [[ -v array[expr]] ]] does arith expression evaluation
detailsdetails
163 passed, 11 OK, 16 not implemented, 7 BUG, 4 failed, 0 timeouts, 0 cases skipped
4 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:
no quotes
status=2
empty=2
status=2

arith expr
status=2
status=2
stderr:
mksh: <stdin>[4]: test: array[1]: unexpected operator/operand
mksh: <stdin>[7]: test: array[3]: unexpected operator/operand
mksh: <stdin>[10]: test: array[4]: unexpected operator/operand
mksh: <stdin>[16]: test: array[1+1]: unexpected operator/operand
mksh: <stdin>[19]: test: array[4+1]: unexpected operator/operand
osh64 Is element set? test -v a[i]

[osh stdout] Expected 'no quotes\nstatus=0\nempty=0\nstatus=1\n\narith expr\nstatus=0\nstatus=1\n' Got 'no quotes\nstatus=1\nempty=1\nstatus=1\n\narith expr\nstatus=1\nstatus=1\n'

stdout:
no quotes
status=1
empty=1
status=1

arith expr
status=1
status=1
stderr:
mksh65 [[ -v a[i] ]]

stdout:
stderr: 
mksh: <stdin>[2]: syntax error: 'array[1]' unexpected operator/operand
osh65 [[ -v a[i] ]]

[osh stdout] Expected 'status=0\nstatus=1\n\nstatus=0\nstatus=1\n', got 'status=1\nstatus=1\n\nstatus=1\nstatus=1\n'

stdout:
status=1
status=1

status=1
status=1
stderr:
mksh66 [[ -v array[expr]] ]] does arith expression evaluation

stdout:
stderr: 
mksh: <stdin>[6]: syntax error: 'array[zero+0]' unexpected operator/operand
osh66 [[ -v array[expr]] ]] does arith expression evaluation

[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: