Results for assoc.test.sh

statusbashoshosh_ALT
pass 293434
ok 011
N-I 011
BUG 1000
FAIL 033
total393939
casebashoshosh_ALTdescription
0pass pass pass Literal syntax ([x]=y)
1BUG pass pass set associative array to indexed array literal (very surprising bash behavior)
details
2BUG pass pass Can't initialize assoc array with indexed array
details
3BUG pass pass Initializing indexed array with assoc array
details
4pass pass pass create empty assoc array, put, then get
5pass pass pass Empty value (doesn't use EmptyWord?)
6pass pass pass retrieve keys with !
7pass pass pass retrieve values with ${A[@]}
8pass FAIL FAIL coerce to string with ${A[*]}, etc.
detailsdetails
9pass pass pass ${A[@]/b/B}
10pass pass pass ${A[@]#prefix}
11pass pass pass ${assoc} is like ${assoc[0]}
12pass pass pass length ${#a[@]}
13pass pass pass lookup with ${a[0]} -- "0" is a string
14pass pass pass lookup with double quoted strings "mykey"
15pass pass pass lookup with single quoted string
16pass pass pass lookup with unquoted $key and quoted "$i$i"
17BUG pass pass lookup by unquoted string doesn't work in OSH because it's a variable
details
18BUG pass pass bash bug: "i+1" and i+1 are the same key
details
19pass pass pass Array stored in associative array gets converted to string (without strict_array)
20pass pass pass Indexed array as key of associative array coerces to string (without shopt -s strict_array)
21pass pass pass Append to associative array value A['x']+='suffix'
22BUG pass pass Slice of associative array doesn't make sense in bash
details
23pass N-I N-I bash variable can have an associative array part and a string part
detailsdetails
24pass pass pass Associative array expressions inside (( )) with keys that look like numbers
25pass pass pass (( A[5] += 42 ))
26pass pass pass (( A[5] += 42 )) with empty cell
27BUG pass pass setting key to itself (from bash-bug mailing list)
details
28pass ok ok readonly associative array can't be modified
detailsdetails
29pass pass pass associative array and brace expansion
30BUG pass pass bash mangles array #1
details
31BUG pass pass bash mangles array and brace #2
details
32pass pass pass declare -A A=() alowed
33pass pass pass unset -v and assoc array
34pass FAIL FAIL nameref and assoc array
detailsdetails
35pass pass pass ${!ref} and assoc array
36pass pass pass printf -v and assoc array
37BUG pass pass bash bug: (( A["$key"] = 1 )) doesn't work
details
38pass FAIL FAIL Implicit increment of keys
detailsdetails
97 passed, 2 OK, 2 not implemented, 10 BUG, 3 failed, 0 timeouts, 0 cases skipped
3 failed under osh

Details on runs that didn't PASS

bash1 set associative array to indexed array literal (very surprising bash behavior)

stdout:
foo
spam eggs
k1
k2
[]
[]
stderr:
bash: line 6: assoc: foo: must use subscript when assigning associative array
bash: line 6: assoc: 'spam eggs': must use subscript when assigning associative array
bash2 Can't initialize assoc array with indexed array

stdout:
status=0
stderr:
bash: line 1: A: 1: must use subscript when assigning associative array
bash: line 1: A: 2: must use subscript when assigning associative array
bash: line 1: A: 3: must use subscript when assigning associative array
bash3 Initializing indexed array with assoc array

stdout:
status=0
['3']
stderr:
osh8 coerce to string with ${A[*]}, etc.

[osh stdout] Expected "['xx yy']\n['X X Y Y']\n['xx', 'yy']\n['X', 'X', 'Y', 'Y']\n" Got "['xx', 'yy']\n['X X Y Y']\n['xx', 'yy']\n['X', 'X', 'Y', 'Y']\n"

stdout:
['xx', 'yy']
['X X Y Y']
['xx', 'yy']
['X', 'X', 'Y', 'Y']
stderr:
osh_ALT8 coerce to string with ${A[*]}, etc.

[osh_ALT stdout] Expected "['xx yy']\n['X X Y Y']\n['xx', 'yy']\n['X', 'X', 'Y', 'Y']\n" Got "['xx', 'yy']\n['X X Y Y']\n['xx', 'yy']\n['X', 'X', 'Y', 'Y']\n"

stdout:
['xx', 'yy']
['X X Y Y']
['xx', 'yy']
['X', 'X', 'Y', 'Y']
stderr:
bash17 lookup by unquoted string doesn't work in OSH because it's a variable

stdout:
c
stderr:
bash18 bash bug: "i+1" and i+1 are the same key

stdout:
array[i]=6
array[i+1]=7
assoc[i]=string
assoc[i+1]=string+1
assoc[i]=string
assoc[i+1]=string+1
stderr:
bash22 Slice of associative array doesn't make sense in bash

stdout:
['2', '1', '5']
['2', '1', '5']
['1', '5', '4']
['5', '4', '3']
['4', '3']
['3']
stderr:
osh23 bash variable can have an associative array part and a string part

stdout:
1 2
1 2 zero
stderr:
  echo ${assoc[1]} ${assoc[2]} ${assoc}
         ^~~~~
[ stdin ]:8: fatal: Can't index string 'assoc' with integer
osh_ALT23 bash variable can have an associative array part and a string part

stdout:
1 2
1 2 zero
stderr:
  echo ${assoc[1]} ${assoc[2]} ${assoc}
         ^~~~~
[ stdin ]:8: fatal: Can't index string 'assoc' with integer
bash27 setting key to itself (from bash-bug mailing list)

stdout:
value1
value2
stderr:
osh28 readonly associative array can't be modified

stdout:
stderr: 
  A['x']=1
  ^~
[ stdin ]:2: fatal: Can't assign to readonly associative array
osh_ALT28 readonly associative array can't be modified

stdout:
stderr: 
  A['x']=1
  ^~
[ stdin ]:2: fatal: Can't assign to readonly associative array
bash30 bash mangles array #1

stdout:
v2
v2
stderr:
bash31 bash mangles array and brace #2

stdout:
[k2]=-a-
stderr:
osh34 nameref and assoc array

[osh stdout] Expected 'values: val\nbefore val\nafter val2\nvalues: val2\n---\nbefore val2\nafter val3\nvalues: val3\n' Got 'values: val\nbefore A["K"]\nafter val2\nvalues: val\n---\nbefore A[$key]\nafter val3\nvalues: val\n'

stdout:
values: val
before A["K"]
after val2
values: val
---
before A[$key]
after val3
values: val
stderr:
osh_ALT34 nameref and assoc array

[osh_ALT stdout] Expected 'values: val\nbefore val\nafter val2\nvalues: val2\n---\nbefore val2\nafter val3\nvalues: val3\n' Got 'values: val\nbefore A["K"]\nafter val2\nvalues: val\n---\nbefore A[$key]\nafter val3\nvalues: val\n'

stdout:
values: val
before A["K"]
after val2
values: val
---
before A[$key]
after val3
values: val
stderr:
bash37 bash bug: (( A["$key"] = 1 )) doesn't work

stdout:
[]
[]
stderr:
bash: line 6: ((: A[\] = 42 : bad array subscript (error token is "A[\] = 42 ")
osh38 Implicit increment of keys

[osh stdout] Expected "['30', '31', '40', '41']\n['a', 'b', 'x', 'y']\n" Got ''
[osh status] Expected 0, got 2

stdout:
stderr: 
  declare -a arr=( [30]=a b [40]=x y)
                          ^
[ stdin ]:1: Expected associative array pair
osh_ALT38 Implicit increment of keys

[osh_ALT stdout] Expected "['30', '31', '40', '41']\n['a', 'b', 'x', 'y']\n" Got ''
[osh_ALT status] Expected 0, got 2

stdout:
stderr: 
  declare -a arr=( [30]=a b [40]=x y)
                          ^
[ stdin ]:1: Expected associative array pair