Results for nameref.test.sh

statusoshosh_.pyosh_.cc
pass 22124
FAIL 31321
total252525
caseoshosh_.pyosh_.ccdescription
0pass pass FAIL pass array by reference
details
1pass pass FAIL pass assoc array by reference
details
2pass pass FAIL pass local array by reference, relying on DYNAMIC SCOPING
details
3pass pass FAIL flag -n and +n
details
4pass pass FAIL mutating through -n
details
5FAIL FAIL FAIL flag -n combined ${!ref} -- bash INVERTS
detailsdetailsdetails
6pass FAIL pass named ref with $# doesn't work
details
7pass FAIL FAIL named ref with $# and shopt -s strict_nameref
detailsdetails
8pass FAIL FAIL named ref with 1 $1 etc.
detailsdetails
9pass FAIL pass assign to invalid ref
details
10pass FAIL FAIL assign to invalid ref with strict_nameref
detailsdetails
11pass FAIL pass name ref on Undef cell
details
12pass FAIL FAIL assign to empty nameref and invalid nameref
detailsdetails
13pass FAIL FAIL -n attribute before it has a value
detailsdetails
14pass FAIL pass -n attribute on array is hard error, not a warning
details
15pass FAIL FAIL exported nameref
detailsdetails
16pass pass FAIL readonly nameref doesn't prevent assigning through it
details
17pass pass FAIL readonly var can't be assigned through nameref
details
18pass pass FAIL unset nameref
details
19pass pass FAIL Chain of namerefs
details
20pass pass FAIL Mutually recursive namerefs
details
21pass pass FAIL Dynamic scope with namerefs
details
22pass pass FAIL change reference itself
details
23FAIL FAIL FAIL a[2] in nameref
detailsdetailsdetails
24FAIL FAIL FAIL a[expr] in nameref -- DYNAMIC PARSING, don't want this
detailsdetailsdetails
38 passed, 0 OK, 0 not implemented, 0 BUG, 37 failed, 0 timeouts, 0 cases skipped
3 failed under osh

Details on runs that didn't PASS

osh_.cc0 pass array by reference

[osh_.cc stdout] Expected 'zo\n', got ''
[osh_.cc status] Expected 0, got 1

stdout:
stderr: 
    echo "${array_name[$idx]}"
    ^~~~
[ stdin ]:4: fatal: Can't index string 'array_name' with integer
osh_.cc1 pass assoc array by reference

[osh_.cc stdout] Expected 'jam\n', got ''
[osh_.cc status] Expected 0, got 1

stdout:
stderr: 
    echo "${array_name[$idx]}"
    ^~~~
[ stdin ]:4: fatal: Can't index string 'array_name' with integer
osh_.cc2 pass local array by reference, relying on DYNAMIC SCOPING

[osh_.cc stdout] Expected 'zo\n', got ''
[osh_.cc status] Expected 0, got 1

stdout:
stderr: 
    echo "${array_name[$idx]}"
    ^~~~
[ stdin ]:4: fatal: Can't index string 'array_name' with integer
osh_.cc3 flag -n and +n

[osh_.cc stdout] Expected 'ref=x\nref=foo\nref=bar\nref=x\n', got 'ref=x\nref=x\nref=x\nref=x\n'

stdout:
ref=x
ref=x
ref=x
ref=x
stderr:
osh_.cc4 mutating through -n

[osh_.cc stdout] Expected '1 ref=y\n2 ref=YY\n3 ref=XXXX\n4 y=XXXX\n', got '1 ref=y\n2 ref=y\n3 ref=XXXX\n4 y=YY\n'

stdout:
1 ref=y
2 ref=y
3 ref=XXXX
4 y=YY
stderr:
osh5 flag -n combined ${!ref} -- bash INVERTS

[osh stdout] Expected 'ref=x\n!ref=foo\nNOW A NAMEREF\nref=foo\n!ref=x\n', got 'ref=x\n!ref=foo\nNOW A NAMEREF\nref=foo\n!ref=FOO\n'

stdout:
ref=x
!ref=foo
NOW A NAMEREF
ref=foo
!ref=FOO
stderr:
osh_.py5 flag -n combined ${!ref} -- bash INVERTS

[osh_.py stdout] Expected 'ref=x\n!ref=foo\nNOW A NAMEREF\nref=foo\n!ref=x\n', got 'ref=x\n!ref=foo\nNOW A NAMEREF\nref=foo\n!ref=FOO\n'

stdout:
ref=x
!ref=foo
NOW A NAMEREF
ref=foo
!ref=FOO
stderr:
osh_.cc5 flag -n combined ${!ref} -- bash INVERTS

[osh_.cc stdout] Expected 'ref=x\n!ref=foo\nNOW A NAMEREF\nref=foo\n!ref=x\n', got 'ref=x\n!ref=foo\nNOW A NAMEREF\nref=x\n!ref=foo\n'

stdout:
ref=x
!ref=foo
NOW A NAMEREF
ref=x
!ref=foo
stderr:
osh_.py6 named ref with $# doesn't work

[osh_.py stdout] Expected 'ref=#\nref=#\n', got 'ref=#\n'
[osh_.py status] Expected 0, got 1
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
ref=#
stderr:
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 547, in _Dispatch
    cmd_val = self.word_ev.EvalWordSequence2(words, allow_assign=True)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1868, in EvalWordSequence2
    self._EvalWordToParts(w, False, part_vals)  # not double quoted
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1455, in _EvalWordToParts
    self._EvalWordPart(p, part_vals, quoted=quoted, is_subst=is_subst)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1344, in _EvalWordPart
    self._EvalSimpleVarSub(part.token, part_vals, quoted)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1245, in _EvalSimpleVarSub
    val = self.mem.GetVar(var_name)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1422, in GetVar
    cell, _, _ = self._ResolveNameOrRef(name, lookup_mode)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1053, in _ResolveNameOrRef
    if self.exec_opts.strict_nameref():
AttributeError: 'NoneType' object has no attribute 'strict_nameref'
osh_.py7 named ref with $# and shopt -s strict_nameref

[osh_.py stderr] Found 'Traceback (most recent'

stdout:
ref=#
stderr:
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 547, in _Dispatch
    cmd_val = self.word_ev.EvalWordSequence2(words, allow_assign=True)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1868, in EvalWordSequence2
    self._EvalWordToParts(w, False, part_vals)  # not double quoted
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1455, in _EvalWordToParts
    self._EvalWordPart(p, part_vals, quoted=quoted, is_subst=is_subst)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1344, in _EvalWordPart
    self._EvalSimpleVarSub(part.token, part_vals, quoted)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1245, in _EvalSimpleVarSub
    val = self.mem.GetVar(var_name)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1422, in GetVar
    cell, _, _ = self._ResolveNameOrRef(name, lookup_mode)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1053, in _ResolveNameOrRef
    if self.exec_opts.strict_nameref():
AttributeError: 'NoneType' object has no attribute 'strict_nameref'
osh_.cc7 named ref with $# and shopt -s strict_nameref

[osh_.cc stdout] Expected 'ref=#\n', got 'ref=#\nref=#\n'
[osh_.cc status] Expected 1, got 0

stdout:
ref=#
ref=#
stderr:
osh_.py8 named ref with 1 $1 etc.

[osh_.py stdout] Expected 'ref=1\nref=1\nref2=$1\nref2=$1\nref3=x\nref3=foo\n', got 'ref=1\n'
[osh_.py status] Expected 0, got 1
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
ref=1
stderr:
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 547, in _Dispatch
    cmd_val = self.word_ev.EvalWordSequence2(words, allow_assign=True)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1868, in EvalWordSequence2
    self._EvalWordToParts(w, False, part_vals)  # not double quoted
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1455, in _EvalWordToParts
    self._EvalWordPart(p, part_vals, quoted=quoted, is_subst=is_subst)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1344, in _EvalWordPart
    self._EvalSimpleVarSub(part.token, part_vals, quoted)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1245, in _EvalSimpleVarSub
    val = self.mem.GetVar(var_name)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1422, in GetVar
    cell, _, _ = self._ResolveNameOrRef(name, lookup_mode)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1053, in _ResolveNameOrRef
    if self.exec_opts.strict_nameref():
AttributeError: 'NoneType' object has no attribute 'strict_nameref'
osh_.cc8 named ref with 1 $1 etc.

[osh_.cc stdout] Expected 'ref=1\nref=1\nref2=$1\nref2=$1\nref3=x\nref3=foo\n', got 'ref=1\nref=1\nref2=$1\nref2=$1\nref3=x\nref3=x\n'

stdout:
ref=1
ref=1
ref2=$1
ref2=$1
ref3=x
ref3=x
stderr:
set 5
osh_.py9 assign to invalid ref

[osh_.py stdout] Expected 'ref=1\nref=1\nref=foo\n', got 'ref=1\n'
[osh_.py status] Expected 0, got 1
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
ref=1
stderr:
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 547, in _Dispatch
    cmd_val = self.word_ev.EvalWordSequence2(words, allow_assign=True)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1868, in EvalWordSequence2
    self._EvalWordToParts(w, False, part_vals)  # not double quoted
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1455, in _EvalWordToParts
    self._EvalWordPart(p, part_vals, quoted=quoted, is_subst=is_subst)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1344, in _EvalWordPart
    self._EvalSimpleVarSub(part.token, part_vals, quoted)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1245, in _EvalSimpleVarSub
    val = self.mem.GetVar(var_name)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1422, in GetVar
    cell, _, _ = self._ResolveNameOrRef(name, lookup_mode)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1053, in _ResolveNameOrRef
    if self.exec_opts.strict_nameref():
AttributeError: 'NoneType' object has no attribute 'strict_nameref'
osh_.py10 assign to invalid ref with strict_nameref

[osh_.py stderr] Found 'Traceback (most recent'

stdout:
ref=1
stderr:
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 547, in _Dispatch
    cmd_val = self.word_ev.EvalWordSequence2(words, allow_assign=True)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1868, in EvalWordSequence2
    self._EvalWordToParts(w, False, part_vals)  # not double quoted
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1455, in _EvalWordToParts
    self._EvalWordPart(p, part_vals, quoted=quoted, is_subst=is_subst)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1344, in _EvalWordPart
    self._EvalSimpleVarSub(part.token, part_vals, quoted)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1245, in _EvalSimpleVarSub
    val = self.mem.GetVar(var_name)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1422, in GetVar
    cell, _, _ = self._ResolveNameOrRef(name, lookup_mode)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1053, in _ResolveNameOrRef
    if self.exec_opts.strict_nameref():
AttributeError: 'NoneType' object has no attribute 'strict_nameref'
osh_.cc10 assign to invalid ref with strict_nameref

[osh_.cc stdout] Expected 'ref=1\n', got 'ref=1\nref=1\nref=foo\n'
[osh_.cc status] Expected 1, got 0

stdout:
ref=1
ref=1
ref=foo
stderr:
osh_.py11 name ref on Undef cell

[osh_.py stdout] Expected 'ref=\nnounset\n', got ''
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
stderr: 
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 547, in _Dispatch
    cmd_val = self.word_ev.EvalWordSequence2(words, allow_assign=True)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1868, in EvalWordSequence2
    self._EvalWordToParts(w, False, part_vals)  # not double quoted
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1455, in _EvalWordToParts
    self._EvalWordPart(p, part_vals, quoted=quoted, is_subst=is_subst)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1344, in _EvalWordPart
    self._EvalSimpleVarSub(part.token, part_vals, quoted)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1245, in _EvalSimpleVarSub
    val = self.mem.GetVar(var_name)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1422, in GetVar
    cell, _, _ = self._ResolveNameOrRef(name, lookup_mode)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1038, in _ResolveNameOrRef
    if self.exec_opts.strict_nameref():
AttributeError: 'NoneType' object has no attribute 'strict_nameref'
osh_.py12 assign to empty nameref and invalid nameref

[osh_.py stdout] Expected 'ref=\nref=\nref2=\nref2=x\n', got ''
[osh_.py status] Expected 0, got 1
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
stderr: 
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 547, in _Dispatch
    cmd_val = self.word_ev.EvalWordSequence2(words, allow_assign=True)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1868, in EvalWordSequence2
    self._EvalWordToParts(w, False, part_vals)  # not double quoted
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1455, in _EvalWordToParts
    self._EvalWordPart(p, part_vals, quoted=quoted, is_subst=is_subst)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1344, in _EvalWordPart
    self._EvalSimpleVarSub(part.token, part_vals, quoted)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1245, in _EvalSimpleVarSub
    val = self.mem.GetVar(var_name)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1422, in GetVar
    cell, _, _ = self._ResolveNameOrRef(name, lookup_mode)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1038, in _ResolveNameOrRef
    if self.exec_opts.strict_nameref():
AttributeError: 'NoneType' object has no attribute 'strict_nameref'
osh_.cc12 assign to empty nameref and invalid nameref

[osh_.cc stdout] Expected 'ref=\nref=\nref2=\nref2=x\n', got 'ref=\nref=x\nref2=undef\nref2=x\n'

stdout:
ref=
ref=x
ref2=undef
ref2=x
stderr:
osh_.py13 -n attribute before it has a value

[osh_.py stdout] Expected 'ref=\nref=XX\n', got ''
[osh_.py status] Expected 0, got 1
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
stderr: 
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 547, in _Dispatch
    cmd_val = self.word_ev.EvalWordSequence2(words, allow_assign=True)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1868, in EvalWordSequence2
    self._EvalWordToParts(w, False, part_vals)  # not double quoted
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1455, in _EvalWordToParts
    self._EvalWordPart(p, part_vals, quoted=quoted, is_subst=is_subst)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1344, in _EvalWordPart
    self._EvalSimpleVarSub(part.token, part_vals, quoted)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1245, in _EvalSimpleVarSub
    val = self.mem.GetVar(var_name)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1422, in GetVar
    cell, _, _ = self._ResolveNameOrRef(name, lookup_mode)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1038, in _ResolveNameOrRef
    if self.exec_opts.strict_nameref():
AttributeError: 'NoneType' object has no attribute 'strict_nameref'
osh_.cc13 -n attribute before it has a value

[osh_.cc stdout] Expected 'ref=\nref=XX\n', got 'ref=\nref=x\n'

stdout:
ref=
ref=x
stderr:
osh_.py14 -n attribute on array is hard error, not a warning

[osh_.py stderr] Found 'Traceback (most recent'

stdout:
hi
stderr:
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 848, in _Dispatch
    self.mem.SetVar(lval, val, lookup_mode, flags=flags)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1172, in SetVar
    cell, name_map, cell_name = self._ResolveNameOrRef(lval.name, lookup_mode)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1038, in _ResolveNameOrRef
    if self.exec_opts.strict_nameref():
AttributeError: 'NoneType' object has no attribute 'strict_nameref'
osh_.py15 exported nameref

[osh_.py stdout] Expected 'None\nx\n---\nfoo\nx\n', got 'None\nNone\n---\nNone\nNone\n'

stdout:
None
None
---
None
None
stderr:
osh_.cc15 exported nameref

[osh_.cc stdout] Expected 'None\nx\n---\nfoo\nx\n', got '(cmd_value.Argv argv:[printenv.py x ref] arg_spids:[12 14 16])\n---\n(cmd_value.Argv argv:[printenv.py x ref] arg_spids:[26 28 30])\n'

stdout:
(cmd_value.Argv argv:[printenv.py x ref] arg_spids:[12 14 16])
---
(cmd_value.Argv argv:[printenv.py x ref] arg_spids:[26 28 30])
stderr:
Unhandled SimpleCommand
Unhandled SimpleCommand
osh_.cc16 readonly nameref doesn't prevent assigning through it

[osh_.cc stdout] Expected 'ref=XX\nref=XXXX\nx=X\n', got 'ref=x\nref=XXXX\nx=X\n'

stdout:
ref=x
ref=XXXX
x=X
stderr:
osh_.cc17 readonly var can't be assigned through nameref

[osh_.cc stdout] Expected 'ref=X\nref=XX\n', got 'ref=x\nref=XX\nref=XXX\nx=X\n'
[osh_.cc status] Expected 1, got 0

stdout:
ref=x
ref=XX
ref=XXX
x=X
stderr:
osh_.cc18 unset nameref

[osh_.cc stdout] Expected 'ref=X\nref=\nx=\n', got 'ref=x\nref=x\nx=X\n'

stdout:
ref=x
ref=x
x=X
stderr:
osh_.cc19 Chain of namerefs

[osh_.cc stdout] Expected 'ref_to_ref=foo\nref=foo\n', got 'ref_to_ref=ref\nref=x\n'

stdout:
ref_to_ref=ref
ref=x
stderr:
osh_.cc20 Mutually recursive namerefs

[osh_.cc stdout] Expected u'', got 'defined\nref1=ref2\nref2=ref2\n'
[osh_.cc status] Expected 1, got 0

stdout:
defined
ref1=ref2
ref2=ref2
stderr:
osh_.cc21 Dynamic scope with namerefs

[osh_.cc stdout] Expected 'F1=F1\nF1=x\n', got 'F1=F1\nF1=F1\n'

stdout:
F1=F1
F1=F1
stderr:
osh_.cc22 change reference itself

[osh_.cc stdout] Expected 'ref=XX\nx=XX\ny=YY\n----\nref=YY\nx=XX\ny=YY\n----\nref=z\nx=XX\ny=z\n', got 'ref=x\nx=XX\ny=YY\n----\nref=y\nx=XX\ny=YY\n----\nref=z\nx=XX\ny=YY\n'

stdout:
ref=x
x=XX
y=YY
----
ref=y
x=XX
y=YY
----
ref=z
x=XX
y=YY
stderr:
osh23 a[2] in nameref

[osh stdout] Expected 'ref=two\n', got 'ref=a[2]\n'

stdout:
ref=a[2]
stderr:
osh_.py23 a[2] in nameref

[osh_.py stdout] Expected 'ref=two\n', got ''
[osh_.py status] Expected 0, got 1
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
stderr: 
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 547, in _Dispatch
    cmd_val = self.word_ev.EvalWordSequence2(words, allow_assign=True)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1868, in EvalWordSequence2
    self._EvalWordToParts(w, False, part_vals)  # not double quoted
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1455, in _EvalWordToParts
    self._EvalWordPart(p, part_vals, quoted=quoted, is_subst=is_subst)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1344, in _EvalWordPart
    self._EvalSimpleVarSub(part.token, part_vals, quoted)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1245, in _EvalSimpleVarSub
    val = self.mem.GetVar(var_name)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1422, in GetVar
    cell, _, _ = self._ResolveNameOrRef(name, lookup_mode)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1053, in _ResolveNameOrRef
    if self.exec_opts.strict_nameref():
AttributeError: 'NoneType' object has no attribute 'strict_nameref'
osh_.cc23 a[2] in nameref

[osh_.cc stdout] Expected 'ref=two\n', got 'ref=a[2]\n'

stdout:
ref=a[2]
stderr:
osh24 a[expr] in nameref -- DYNAMIC PARSING, don't want this

[osh stdout] Expected 'ref=three\n', got 'ref=a[$(echo 2) + 1]\n'

stdout:
ref=a[$(echo 2) + 1]
stderr:
osh_.py24 a[expr] in nameref -- DYNAMIC PARSING, don't want this

[osh_.py stdout] Expected 'ref=three\n', got ''
[osh_.py status] Expected 0, got 1
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
stderr: 
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 547, in _Dispatch
    cmd_val = self.word_ev.EvalWordSequence2(words, allow_assign=True)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1868, in EvalWordSequence2
    self._EvalWordToParts(w, False, part_vals)  # not double quoted
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1455, in _EvalWordToParts
    self._EvalWordPart(p, part_vals, quoted=quoted, is_subst=is_subst)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1344, in _EvalWordPart
    self._EvalSimpleVarSub(part.token, part_vals, quoted)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1245, in _EvalSimpleVarSub
    val = self.mem.GetVar(var_name)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1422, in GetVar
    cell, _, _ = self._ResolveNameOrRef(name, lookup_mode)
  File "/home/andy/git/oilshell/oil/core/state.py", line 1053, in _ResolveNameOrRef
    if self.exec_opts.strict_nameref():
AttributeError: 'NoneType' object has no attribute 'strict_nameref'
osh_.cc24 a[expr] in nameref -- DYNAMIC PARSING, don't want this

[osh_.cc stdout] Expected 'ref=three\n', got 'ref=a[$(echo 2) + 1]\n'

stdout:
ref=a[$(echo 2) + 1]
stderr: