Results for assoc.test.sh

casebashoshdescription
0pass pass TODO: SETUP should be share
1pass pass create empty assoc array, put, then get
2pass FAIL retrieve indices with !
details
3pass FAIL $a gives nothing
details
4pass FAIL length of dict does not work
details
5pass FAIL index by number doesn't work
details
6pass FAIL index by key name
details
7pass FAIL index by quoted string
details
8pass FAIL index by unquoted string
details
9pass FAIL index by unquoted string as arithmetic
details
10pass FAIL WTF index by key name
details
11pass pass Array stored in associative array gets converted to string
12BUG FAIL Can't initialize assoc array with indexed array
detailsdetails
13BUG pass Initializing indexed array with with assoc array drops the constants
details
14pass FAIL Append to associative array value
details

17 passed, 0 ok, 0 known unimplemented, 2 known bugs, 11 failed, 0 skipped

Details on runs that didn't PASS

osh2 retrieve indices with !

[osh stdout] Expected "['foo', 'aa', 'a+1']\n", got "['0', '1', '2']\n"

stdout:
['0', '1', '2']
stderr:
osh3 $a gives nothing

[osh stdout] Expected u'\n', got '[aa]=b [foo]=bar [a+1]=c\n'

stdout:
[aa]=b [foo]=bar [a+1]=c
stderr:
osh4 length of dict does not work

[osh stdout] Expected '0\n', got '3\n'

stdout:
3
stderr:
osh5 index by number doesn't work

[osh stdout] Expected u'0 1 2 \n', got '0 [aa]=b 1 [foo]=bar 2 [a+1]=c\n'

stdout:
0 [aa]=b 1 [foo]=bar 2 [a+1]=c
stderr:
osh6 index by key name

[osh stdout] Expected u'b bar c\n', got '[aa]=b [aa]=b [aa]=b\n'

stdout:
[aa]=b [aa]=b [aa]=b
stderr:
  echo "${a[aa]}" "${a[foo]}" "${a['a+1']}"
            ^~
[ stdin ]:3: warning: Coercing undefined value to 0 in arithmetic context
  echo "${a[aa]}" "${a[foo]}" "${a['a+1']}"
                       ^~~
[ stdin ]:3: warning: Coercing undefined value to 0 in arithmetic context
  echo "${a[aa]}" "${a[foo]}" "${a['a+1']}"
                                   ^
[ stdin ]:3: warning: Invalid integer constant 'a+1'
osh7 index by quoted string

[osh stdout] Expected 'c\n', got '[aa]=b\n'

stdout:
[aa]=b
stderr:
  echo "${a['a+1']}"
            ^
[ stdin ]:3: warning: Invalid integer constant 'a+1'
osh8 index by unquoted string

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

stdout:
stderr: 
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 857, in <module>
    main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 825, in main
    sys.exit(AppBundleMain(argv))
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 795, in AppBundleMain
    status = ShellMain('osh', argv0, main_argv, login_shell)
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 614, 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 163, in Batch
    is_control_flow, is_fatal = ex.ExecuteAndCatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1185, in ExecuteAndCatch
    status = self._Execute(node, fork_external=fork_external)
  File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1133, in _Execute
    status, check_errexit = self._Dispatch(node, fork_external)
  File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 646, in _Dispatch
    arg_vec = self.word_ev.EvalWordSequence2(words)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1107, in EvalWordSequence2
    self._EvalWordToParts(w, False, part_vals)  # not double quoted
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 888, in _EvalWordToParts
    self._EvalWordPart(p, part_vals, quoted=quoted)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 816, in _EvalWordPart
    self._EvalDoubleQuotedPart(part, part_vals)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 465, in _EvalDoubleQuotedPart
    self._EvalWordPart(p, part_vals, quoted=True)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 851, in _EvalWordPart
    self._EvalBracedVarSub(part, part_vals, quoted)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 577, in _EvalBracedVarSub
    index = self.arith_ev.Eval(anode)
  File "/home/andy/git/oilshell/oil/osh/expr_eval.py", line 470, in Eval
    return lhs + rhs
TypeError: can only concatenate list (not "int") to list
osh9 index by unquoted string as arithmetic

[osh stdout] Expected u'\nc\n7\n', got '\n\n7\n'

stdout:

7
stderr:
osh10 WTF index by key name

[osh stdout] Expected u'bb dd\n', got '[xx]=bb [xx]=bb\n'

stdout:
[xx]=bb [xx]=bb
stderr:
  echo "${a[xx]}" "${a[cc]}"
            ^~
[ stdin ]:3: warning: Coercing undefined value to 0 in arithmetic context
  echo "${a[xx]}" "${a[cc]}"
                       ^~
[ stdin ]:3: warning: Coercing undefined value to 0 in arithmetic context
bash12 Can't initialize assoc array with indexed array

stdout:
stderr: 
_tmp/spec-bin/bash: line 1: A: 1: must use subscript when assigning associative array
_tmp/spec-bin/bash: line 1: A: 2: must use subscript when assigning associative array
_tmp/spec-bin/bash: line 1: A: 3: must use subscript when assigning associative array
osh12 Can't initialize assoc array with indexed array

[osh status] Expected 1, got 0

stdout:
stderr: 
bash13 Initializing indexed array with with assoc array drops the constants

stdout:
3
stderr:
osh14 Append to associative array value

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

stdout:
stderr: 
  a['x']+='foo'
    ^
[ array LValue in (source.Stdin comment:'') ]:2: warning: Invalid integer constant 'x'
  a['x']+='bar'
    ^
[ array LValue in (source.Stdin comment:'') ]:3: warning: Invalid integer constant 'x'
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 857, in <module>
    main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 825, in main
    sys.exit(AppBundleMain(argv))
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 795, in AppBundleMain
    status = ShellMain('osh', argv0, main_argv, login_shell)
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 614, 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 163, in Batch
    is_control_flow, is_fatal = ex.ExecuteAndCatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1185, in ExecuteAndCatch
    status = self._Execute(node, fork_external=fork_external)
  File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 1133, in _Execute
    status, check_errexit = self._Dispatch(node, fork_external)
  File "/home/andy/git/oilshell/oil/osh/cmd_exec.py", line 758, in _Dispatch
    self.mem, self.exec_opts)
  File "/home/andy/git/oilshell/oil/osh/expr_eval.py", line 205, in EvalLhsAndLookup
    raise NotImplementedError
NotImplementedError