spec test index / oilshell.org
66 passed, 1 OK, 1 not implemented, 10 BUG, 6 failed, 0 timeouts, 0 cases skipped 6 failed under osh
bash-4 | 1 set associative array to indexed array literal (very surprising bash behavior) stdout: foo spam eggs k1 k2 [] []stderr: bash-4.4: line 6: assoc: foo: must use subscript when assigning associative array bash-4.4: line 6: assoc: 'spam eggs': must use subscript when assigning associative array |
bash-4 | 2 Can't initialize assoc array with indexed array stdout: status=0stderr: bash-4.4: line 1: A: 1: must use subscript when assigning associative array bash-4.4: line 1: A: 2: must use subscript when assigning associative array bash-4.4: line 1: A: 3: must use subscript when assigning associative array |
bash-4 | 3 Initializing indexed array with assoc array stdout: status=0 ['3']stderr: |
osh | 8 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: |
bash-4 | 17 lookup by unquoted string doesn't work in OSH because it's a variable stdout: cstderr: |
bash-4 | 18 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+1stderr: |
bash-4 | 22 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: |
osh | 23 bash variable can have an associative array part and a string part stdout: 1 2 1 2 zerostderr: echo ${assoc[1]} ${assoc[2]} ${assoc} ^~~~~ [ stdin ]:8: fatal: Can't index string 'assoc' with integer |
bash-4 | 27 setting key to itself (from bash-bug mailing list) stdout: value1 value2stderr: |
osh | 28 readonly associative array can't be modified stdout: stderr: A['x']=1 ^~ [ stdin ]:2: fatal: Can't assign to readonly associative array |
bash-4 | 30 bash mangles array #1 stdout: v2 v2stderr: |
bash-4 | 31 bash mangles array and brace #2 stdout: [k2]=-a-stderr: |
osh | 34 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: valstderr: |
bash-4 | 37 bash bug: (( A["$key"] = 1 )) doesn't work stdout: [] []stderr: bash-4.4: line 6: ((: A[\] = 42 : bad array subscript (error token is "A[\] = 42 ") |
osh | 38 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 | 39 test -v assoc[key] [osh stdout] Expected 'no quotes\nempty=0\nk=0\nnonexistent=1\n\nquotes\nempty=0\nk=0\nnonexistent=1\n\nvars\nempty=0\nk=0\nnonexistent=1\n' Got 'no quotes\nempty=1\nk=1\nnonexistent=1\n\nquotes\nempty=1\nk=1\nnonexistent=1\n\nvars\nempty=1\nk=1\nnonexistent=1\n' stdout: no quotes empty=1 k=1 nonexistent=1 quotes empty=1 k=1 nonexistent=1 vars empty=1 k=1 nonexistent=1stderr: |
osh | 40 [[ -v assoc[key] ]] [osh stdout] Expected 'no quotes\nempty=0\nk=0\nnonexistent=1\n\nquotes\nempty=0\nk=0\nnonexistent=1\n\nvars\nempty=0\nk=0\nnonexistent=1\n' Got 'no quotes\nempty=1\nk=1\nnonexistent=1\n\nquotes\nempty=1\nk=1\nnonexistent=1\n\nvars\nempty=1\nk=1\nnonexistent=1\n' stdout: no quotes empty=1 k=1 nonexistent=1 quotes empty=1 k=1 nonexistent=1 vars empty=1 k=1 nonexistent=1stderr: |
osh | 41 [[ -v assoc[key] ]] syntax errors [osh stdout] Expected 'empty=0\nk=0\ntypo=1\n', got 'empty=1\nk=1\ntypo=1\n' stdout: empty=1 k=1 typo=1stderr: |