Results for array.test.sh

casebashmkshoshosh_ALTosh-byterundescription
0pass pass pass pass pass SETUP
1pass pass pass pass pass "${a[@]}" and "${a[*]}"
2pass pass pass pass pass ${a[@]} and ${a[*]}
3pass pass pass pass pass 4 ways to interpolate empty array
4pass pass pass pass pass empty array
5pass pass pass pass pass Empty array with :-
6pass BUG pass pass pass nounset with empty array (design bug, makes it hard to use arrays)
details
7pass BUG pass pass pass local array
details
8pass pass pass pass pass Command with with word splitting in array
9pass ok pass pass pass space before ( in array initialization
details
10pass pass pass pass pass array over multiple lines
11pass ok pass pass pass array with invalid token
details
12pass pass pass pass pass array with empty string
13pass pass pass pass pass Retrieve index
14pass pass pass pass pass Retrieve out of bounds index
15pass N-I pass pass pass Negative index
details
16pass pass pass pass pass Retrieve index that is a variable
17pass pass pass pass pass Retrieve index that is a variable without $
18pass pass pass pass pass Retrieve index that is a command sub
19pass pass pass pass pass Retrieve array indices with ${!a}
20pass pass pass pass pass Retrieve sparse array indices with ${!a}
21pass N-I pass pass pass ${!a[1]} is named ref in bash
details
22pass ok FAIL FAIL FAIL ${!a} on array
detailsdetailsdetailsdetails
23pass pass pass pass pass All elements unquoted
24pass pass pass pass pass All elements quoted
25pass pass pass pass pass $*
26pass pass pass pass pass "$*"
27pass pass pass pass pass Interpolate array into array
28pass ok ok ok ok Exporting array doesn't do anything, not even first element
detailsdetailsdetailsdetails
29ok ok pass pass pass Arrays can't be used as env bindings
detailsdetails
30pass pass pass pass pass Set element
31pass pass pass pass pass Set element with var ref
32pass pass pass pass pass Set element with array ref
33pass N-I FAIL FAIL FAIL Set array item to array
detailsdetailsdetailsdetails
34pass N-I pass pass pass Slice of array with [@]
details
35pass N-I pass pass pass Negative slice
details
36pass N-I pass pass pass Slice with arithmetic
details
37pass pass pass pass pass Number of elements
38pass pass pass pass pass Length of an element
39pass pass pass pass pass Iteration
40pass pass pass pass pass glob within array yields separate elements
41pass pass pass pass pass declare array and then append
42pass ok pass pass pass Array syntax in wrong place
details
43ok ok ok ok ok Single array with :-
detailsdetailsdetailsdetailsdetails
44pass N-I pass pass pass Stripping a whole array unquoted
details
45pass N-I pass pass pass Stripping a whole array quoted
details
46ok ok pass pass pass Multiple subscripts not allowed
detailsdetails
47ok ok pass pass pass Length op, index op, then transform op is not allowed
detailsdetails
48BUG BUG pass pass pass Array subscript not allowed on string
detailsdetails
49pass pass pass pass pass Create a "user" array out of the argv array
50pass pass pass pass pass Tilde expansion within array
51pass pass pass pass pass Brace Expansion within Array
52pass pass pass pass pass array default
53ok ok pass pass pass Singleton Array Copy and Assign. Can't index string with int.
detailsdetails
54pass pass pass pass pass declare -a / local -a is empty array
55pass pass pass pass pass Create sparse array
56pass pass pass pass pass Create sparse array implicitly
57pass pass pass pass pass Append sparse arrays
58pass N-I pass pass pass Slice of sparse array with [@]
details
59pass pass FAIL FAIL FAIL Using an array itself as the index
detailsdetailsdetails

257 passed, 21 ok, 9 known unimplemented, 4 known bugs, 3 failed, 0 skipped

Details on runs that didn't PASS

mksh6 nounset with empty array (design bug, makes it hard to use arrays)

stdout:
stderr: 
_tmp/spec-bin/mksh: <stdin>[3]: empty[@]: parameter not set
mksh7 local array

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

stdout:
1
stderr:
mksh11 array with invalid token

stdout:
stderr: 
_tmp/spec-bin/mksh: <stdin>[3]: syntax error: '&' unexpected
mksh15 Negative index

stdout:
['', '', '']
stderr:
mksh21 ${!a[1]} is named ref in bash

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

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

[osh stdout] Expected "['']\n", got "['0', '1']\n"

stdout:
['0', '1']
stderr:
osh_ALT22 ${!a} on array

[osh_ALT stdout] Expected "['']\n", got "['0', '1']\n"

stdout:
['0', '1']
stderr:
osh-byterun22 ${!a} on array

[osh-byterun stdout] Expected "['']\n", got "['0', '1']\n"

stdout:
['0', '1']
stderr:
mksh28 Exporting array doesn't do anything, not even first element

stdout:
stderr: 
_tmp/spec-bin/mksh: <stdin>[1]: syntax error: '(' unexpected
osh28 Exporting array doesn't do anything, not even first element

stdout:
stderr: 
Line 1 of '<stdin>'
  export PYTHONPATH=(a b c)
         ^~~~~~~~~~~
Commands can't contain array literals
osh_ALT28 Exporting array doesn't do anything, not even first element

stdout:
stderr: 
Line 1 of '<stdin>'
  export PYTHONPATH=(a b c)
         ^~~~~~~~~~~
Commands can't contain array literals
osh-byterun28 Exporting array doesn't do anything, not even first element

stdout:
stderr: 
Line 1 of '<stdin>'
  export PYTHONPATH=(a b c)
         ^~~~~~~~~~~
Commands can't contain array literals
bash29 Arrays can't be used as env bindings

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

stdout:
stderr: 
_tmp/spec-bin/mksh: <stdin>[1]: syntax error: '(' unexpected
mksh33 Set array item to array

stdout:
stderr: 
_tmp/spec-bin/mksh: <stdin>[2]: set: a[0]: is not an identifier
osh33 Set array item to array

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

stdout:
stderr: 
Line 2 of '<stdin>'
  a[0]=(3 4)
        ^
Expected word type Right_FuncDef, got Word_Compound
osh_ALT33 Set array item to array

[osh_ALT stdout] Expected 'status=1\n', got ''
[osh_ALT status] Expected 0, got 2

stdout:
stderr: 
Line 2 of '<stdin>'
  a[0]=(3 4)
        ^
Expected word type Right_FuncDef, got Word_Compound
osh-byterun33 Set array item to array

[osh-byterun stdout] Expected 'status=1\n', got ''
[osh-byterun status] Expected 0, got 2

stdout:
stderr: 
Line 2 of '<stdin>'
  a[0]=(3 4)
        ^
Expected word type Right_FuncDef, got Word_Compound
mksh34 Slice of array with [@]

stdout:
stderr: 
_tmp/spec-bin/mksh: <stdin>[2]: ${a[@]: 1:2}: bad substitution
mksh35 Negative slice

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

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

stdout:
stderr: 
_tmp/spec-bin/mksh: <stdin>[1]: syntax error: '(' unexpected
bash43 Single array with :-

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

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

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

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

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

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

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

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

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

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

stdout:
stderr: 
_tmp/spec-bin/mksh: <stdin>[2]: ${#a[0]/1/xxx}: bad substitution
bash48 Array subscript not allowed on string

stdout:
abc
stderr:
mksh48 Array subscript not allowed on string

stdout:
abc
stderr:
bash53 Singleton Array Copy and Assign. Can't index string with int.

stdout:
4 4
1 1
4 4
1 1
stderr:
mksh53 Singleton Array Copy and Assign. Can't index string with int.

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

stdout:
stderr: 
_tmp/spec-bin/mksh: <stdin>[4]: ${a[@]: 15:2}: bad substitution
osh59 Using an array itself as the index

[osh stdout] Expected "['42', '99', '42', '99', '']\n", got ''
[osh status] Expected 0, got 1

stdout:
stderr: 
Line 1 of '<stdin>'
  a[a]=42
  ^~
osh warning: Coercing undefined value to 0 in arithmetic context
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 572, in <module>
    main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 545, in main
    sys.exit(AppBundleMain(argv))
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 519, in AppBundleMain
    status = ShellMain('osh', argv0, main_argv, login_shell)
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 349, in ShellMain
    status = main_loop.Batch(ex, c_parser, arena, nodes_out=nodes_out)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 117, in Batch
    is_control_flow, is_fatal = ex.ExecuteAndCatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1207, in ExecuteAndCatch
    status = self._Execute(node, fork_external=fork_external)
  File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1155, in _Execute
    status, check_errexit = self._Dispatch(node, fork_external)
  File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 818, in _Dispatch
    strict_array=self.exec_opts.strict_array)
  File "/home/andy/git/oilshell/oil/osh/state.py", line 869, in SetVar
    strs[lval.index] = val.s
TypeError: list indices must be integers, not list
osh_ALT59 Using an array itself as the index

[osh_ALT stdout] Expected "['42', '99', '42', '99', '']\n", got ''
[osh_ALT status] Expected 0, got 1

stdout:
stderr: 
Line 1 of '<stdin>'
  a[a]=42
  ^~
osh warning: Coercing undefined value to 0 in arithmetic context
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 563, in _cpython_main_hook
    main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 545, in main
    sys.exit(AppBundleMain(argv))
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 519, in AppBundleMain
    status = ShellMain('osh', argv0, main_argv, login_shell)
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 349, in ShellMain
    status = main_loop.Batch(ex, c_parser, arena, nodes_out=nodes_out)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 124, in Batch
    return ex.LastStatus()
  File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1207, in ExecuteAndCatch
    status = self._Execute(node, fork_external=fork_external)
  File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1155, in _Execute
    status, check_errexit = self._Dispatch(node, fork_external)
  File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1100, in _Dispatch
    libc.print_time(real, user, sys_)
  File "/home/andy/git/oilshell/oil/osh/state.py", line 869, in SetVar
    strs[lval.index] = val.s
TypeError: list indices must be integers, not list
FATAL: couldn't import from app bundle '_tmp/oil-tar-test/oil-0.6.pre11/_bin/osh' (1)
Stripping the oil.ovm binary may cause this error.
See https://github.com/oilshell/oil/issues/47
osh-byterun59 Using an array itself as the index

[osh-byterun stdout] Expected "['42', '99', '42', '99', '']\n", got ''
[osh-byterun status] Expected 0, got 1

stdout:
stderr: 
Line 1 of '<stdin>'
  a[a]=42
  ^~
osh warning: Coercing undefined value to 0 in arithmetic context
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/opy_.py", line 88, in <module>
    main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/opy_.py", line 72, in main
    sys.exit(AppBundleMain(argv))
  File "/home/andy/git/oilshell/oil/bin/opy_.py", line 64, in AppBundleMain
    return opy_main.OpyCommandMain(main_argv)
  File "/home/andy/git/oilshell/oil/opy/opy_main.py", line 502, in OpyCommandMain
    num_ticks = ovm.run_code_object(co, opy_argv)
  File "/home/andy/git/oilshell/oil/opy/byterun/execfile.py", line 36, in run_code_object
    pyvm2.run_code(vm, code, f_globals=main_mod.__dict__)
  File "/home/andy/git/oilshell/oil/opy/byterun/pyvm2.py", line 88, in run_code
    val = vm.run_frame(frame)
  File "/home/andy/git/oilshell/oil/opy/byterun/pyvm2.py", line 327, in run_frame
    raise exctype, value, tb
TypeError: list indices must be integers, not list