Results for array.test.sh

statusbashmkshosh
pass 634174
ok 1170
N-I 3240
BUG 160
FAIL 004
total787878
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 FAIL Command with with word splitting in array
details
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 FAIL Retrieve index that is a command sub
details
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
28ok ok pass Associative arrays can't be used as env bindings either
detailsdetails
29pass pass pass Set element
30pass pass pass Set element with var ref
31pass pass pass Set element with array ref
32BUG N-I pass Set array item to array
detailsdetails
33pass N-I pass Slice of array with [@]
details
34pass N-I pass Negative slice begin
details
35pass pass pass Negative slice length
36pass N-I pass Slice with arithmetic
details
37pass pass pass Number of elements
38pass pass pass Length of an element
39pass pass pass Iteration
40pass pass pass glob within array yields separate elements
41pass pass pass declare array and then append
42ok pass pass Array syntax in wrong place
details
43pass pass pass Single array with :-
44pass N-I pass Stripping a whole array unquoted
details
45pass N-I pass Stripping a whole array quoted
details
46ok ok pass Multiple subscripts not allowed
detailsdetails
47ok ok pass Length op, index op, then transform op is not allowed
detailsdetails
48pass pass pass ${mystr[@]} and ${mystr[*]} are no-ops
49N-I N-I pass ${mystr[@]} and ${mystr[*]} disallowed with strict_array
detailsdetails
50pass pass pass Create a "user" array out of the argv array
51pass pass pass Tilde expansion within array
52pass pass pass Brace Expansion within Array
53pass pass pass array default
54ok ok pass Singleton Array Copy and Assign. OSH can't index strings with ints
detailsdetails
55pass pass pass declare -a / local -a is empty array
56pass pass pass Create sparse array
57pass pass pass Create sparse array implicitly
58pass pass pass Append sparse arrays
59pass N-I pass Slice of sparse array with [@]
details
60pass pass pass Using an array itself as the index on LHS
61pass pass pass Using an array itself as the index on RHS
62pass pass pass a[$x$y] on LHS and RHS
63pass pass pass Dynamic parsing of LHS a[$code]=value
64pass pass pass Dynamic parsing of RHS ${a[$code]}
65pass N-I pass Is element set? test -v a[i]
details
66pass N-I pass [[ -v a[i] ]]
details
67pass N-I FAIL test -v a[i] with arith expressions
detailsdetails
68pass N-I FAIL More arith expressions in [[ -v array[expr]] ]]
detailsdetails
69ok N-I pass Regression: Assigning with out-of-range negative index
detailsdetails
70pass N-I pass Regression: Negative index in [[ -v a[index] ]]
details
71ok N-I pass Regression: Negative out-of-range index in [[ -v a[index] ]]
detailsdetails
72N-I N-I pass a+=() modifies existing instance of BashArray
detailsdetails
73ok N-I pass Regression: unset a[-2]: out-of-bound negative index should cause error
detailsdetails
74pass N-I pass Regression: Out-of-bound negative offset for ${a[@]:offset}
details
75pass N-I pass Regression: Array length after unset
details
76ok N-I pass Regression: ${a[@]@Q} crash with `a[0]=x a[2]=y`
detailsdetails
77ok N-I pass Regression: silent out-of-bound negative index in ${a[-2]} and $((a[-2]))
detailsdetails
178 passed, 18 OK, 27 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
osh2 Command with with word splitting in array

[osh stdout] Expected "['1 2', '3', '4']\n", got ''
[osh status] Expected 0, got 1
[osh stderr] Found 'Traceback (most recent'

stdout:
stderr: 
Traceback (most recent call last):
  File "/home/uke/oil/bin/oils_for_unix.py", line 202, in <module>
    sys.exit(main(sys.argv))
  File "/home/uke/oil/bin/oils_for_unix.py", line 171, in main
    return AppBundleMain(argv)
  File "/home/uke/oil/bin/oils_for_unix.py", line 141, in AppBundleMain
    return shell.Main('osh', arg_r, environ, login_shell, loader, readline)
  File "/home/uke/oil/core/shell.py", line 1253, in Main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/uke/oil/core/main_loop.py", line 336, in Batch
    was_parsed, status = Batch2(cmd_ev, c_parser, errfmt, cmd_flags=cmd_flags)
  File "/home/uke/oil/core/main_loop.py", line 401, in Batch2
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags)
  File "/home/uke/oil/osh/cmd_eval.py", line 2175, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/uke/oil/osh/cmd_eval.py", line 1974, in _Execute
    status = self._Dispatch(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1711, in _Dispatch
    status = self._DoShAssignment(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1028, in _DoShAssignment
    rhs = self.word_ev.EvalRhsWord(pair.rhs)
  File "/home/uke/oil/osh/word_eval.py", line 2179, in EvalRhsWord
    for v in self.EvalWordSequence(words):
  File "/home/uke/oil/osh/word_eval.py", line 2598, in EvalWordSequence
    cmd_val = self.EvalWordSequence2(words, False)
  File "/home/uke/oil/osh/word_eval.py", line 2541, in EvalWordSequence2
    self._EvalWordToParts(w, part_vals, EXTGLOB_FILES)
  File "/home/uke/oil/osh/word_eval.py", line 1989, in _EvalWordToParts
    self._EvalWordPart(p, word_part_vals, eval_flags)
  File "/home/uke/oil/osh/word_eval.py", line 1881, in _EvalWordPart
    quoted)  # type: part_value_t
  File "/home/uke/oil/osh/word_eval.py", line 2629, in _EvalCommandSub
    stdout_str = self.shell_ex.RunCommandSub(cs_part)
  File "/home/uke/oil/core/executor.py", line 691, in RunCommandSub
    status, stdout_str, stderr_str = self.CaptureStdout(node)
  File "/home/uke/oil/core/executor.py", line 619, in CaptureStdout
    fds, w, exc = select.select([r,r2], [], [r,r2], -1)
NameError: global name 'select' is not defined
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:
osh15 Retrieve index that is a command sub

[osh stdout] Expected "['2 3']\n", got ''
[osh status] Expected 0, got 1
[osh stderr] Found 'Traceback (most recent'

stdout:
stderr: 
Traceback (most recent call last):
  File "/home/uke/oil/bin/oils_for_unix.py", line 202, in <module>
    sys.exit(main(sys.argv))
  File "/home/uke/oil/bin/oils_for_unix.py", line 171, in main
    return AppBundleMain(argv)
  File "/home/uke/oil/bin/oils_for_unix.py", line 141, in AppBundleMain
    return shell.Main('osh', arg_r, environ, login_shell, loader, readline)
  File "/home/uke/oil/core/shell.py", line 1253, in Main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/uke/oil/core/main_loop.py", line 336, in Batch
    was_parsed, status = Batch2(cmd_ev, c_parser, errfmt, cmd_flags=cmd_flags)
  File "/home/uke/oil/core/main_loop.py", line 401, in Batch2
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags)
  File "/home/uke/oil/osh/cmd_eval.py", line 2175, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/uke/oil/osh/cmd_eval.py", line 1974, in _Execute
    status = self._Dispatch(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1701, in _Dispatch
    status = self._DoSimple(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 904, in _DoSimple
    allow_assign=True)
  File "/home/uke/oil/osh/word_eval.py", line 2541, in EvalWordSequence2
    self._EvalWordToParts(w, part_vals, EXTGLOB_FILES)
  File "/home/uke/oil/osh/word_eval.py", line 1989, in _EvalWordToParts
    self._EvalWordPart(p, word_part_vals, eval_flags)
  File "/home/uke/oil/osh/word_eval.py", line 1873, in _EvalWordPart
    self._EvalDoubleQuoted(part.parts, part_vals)
  File "/home/uke/oil/osh/word_eval.py", line 1394, in _EvalDoubleQuoted
    self._EvalWordPart(p, part_vals, QUOTED)
  File "/home/uke/oil/osh/word_eval.py", line 1897, in _EvalWordPart
    self._EvalBracedVarSub(part, part_vals, quoted)
  File "/home/uke/oil/osh/word_eval.py", line 1602, in _EvalBracedVarSub
    val = self._EvalBracketOp(val, part, quoted, vsub_state, vtest_place)
  File "/home/uke/oil/osh/word_eval.py", line 1465, in _EvalBracketOp
    val = self._ArrayIndex(val, part, vtest_place)
  File "/home/uke/oil/osh/word_eval.py", line 1328, in _ArrayIndex
    big_index = self.arith_ev.EvalToBigInt(anode)
  File "/home/uke/oil/osh/sh_expr_eval.py", line 557, in EvalToBigInt
    val = self.Eval(node)
  File "/home/uke/oil/osh/sh_expr_eval.py", line 609, in Eval
    return self.word_ev.EvalWordToString(w)
  File "/home/uke/oil/osh/word_eval.py", line 2103, in EvalWordToString
    self._EvalWordPart(p, part_vals, 0)
  File "/home/uke/oil/osh/word_eval.py", line 1881, in _EvalWordPart
    quoted)  # type: part_value_t
  File "/home/uke/oil/osh/word_eval.py", line 2629, in _EvalCommandSub
    stdout_str = self.shell_ex.RunCommandSub(cs_part)
  File "/home/uke/oil/core/executor.py", line 691, in RunCommandSub
    status, stdout_str, stderr_str = self.CaptureStdout(node)
  File "/home/uke/oil/core/executor.py", line 619, in CaptureStdout
    fds, w, exc = select.select([r,r2], [], [r,r2], -1)
NameError: global name 'select' is not defined
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
bash28 Associative arrays can't be used as env bindings either

stdout:
a
([k]=v)
stderr:
mksh28 Associative arrays can't be used as env bindings either

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

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

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

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

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

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

stdout:
stderr: 
bash: line 1: syntax error near unexpected token `('
bash: line 1: `ls foo=(1 2)'
mksh44 Stripping a whole array unquoted

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

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

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

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

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

stdout:
stderr: 
mksh: <stdin>[2]: ${#a[0]/1/xxx}: bad substitution
bash49 ${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
mksh49 ${mystr[@]} and ${mystr[*]} disallowed with strict_array

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

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

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

stdout:
stderr: 
mksh: <stdin>[4]: ${a[@]: 15:2}: bad substitution
mksh65 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
mksh66 [[ -v a[i] ]]

stdout:
stderr: 
mksh: <stdin>[2]: syntax error: 'array[1]' unexpected operator/operand
mksh67 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
osh67 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:
mksh68 More arith expressions in [[ -v array[expr]] ]]

stdout:
stderr: 
mksh: <stdin>[6]: syntax error: 'array[zero+0]' unexpected operator/operand
osh68 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:
bash69 Regression: Assigning with out-of-range negative index

stdout:
stderr: 
bash: line 2: a[-1]: bad array subscript
mksh69 Regression: Assigning with out-of-range negative index

stdout:
stderr: 
mksh70 Regression: Negative index in [[ -v a[index] ]]

stdout:
stderr: 
mksh: <stdin>[4]: syntax error: 'a[-1]' unexpected operator/operand
bash71 Regression: Negative out-of-range index in [[ -v a[index] ]]

stdout:
stderr: 
bash: line 2: e: bad array subscript
mksh71 Regression: Negative out-of-range index in [[ -v a[index] ]]

stdout:
stderr: 
mksh: <stdin>[2]: syntax error: 'e[-1]' unexpected operator/operand
bash72 a+=() modifies existing instance of BashArray

stdout:
stderr: 
mksh72 a+=() modifies existing instance of BashArray

stdout:
stderr: 
bash73 Regression: unset a[-2]: out-of-bound negative index should cause error

stdout:
stderr: 
bash: line 4: unset: [-2]: bad array subscript
mksh73 Regression: unset a[-2]: out-of-bound negative index should cause error

stdout:
stderr: 
mksh74 Regression: Out-of-bound negative offset for ${a[@]:offset}

stdout:
stderr: 
mksh75 Regression: Array length after unset

stdout:
stderr: 
bash76 Regression: ${a[@]@Q} crash with `a[0]=x a[2]=y`

stdout:
quoted = ('x' 'y')
stderr:
mksh76 Regression: ${a[@]@Q} crash with `a[0]=x a[2]=y`

stdout:
stderr: 
bash77 Regression: silent out-of-bound negative index in ${a[-2]} and $((a[-2]))

stdout:
[]
0
[0]
0
stderr:
bash: line 4: a: bad array subscript
bash: line 6: a: bad array subscript
mksh77 Regression: silent out-of-bound negative index in ${a[-2]} and $((a[-2]))

stdout:
stderr: