Results for nameref.test.sh

statusbashmkshosh
pass 251325
ok 290
N-I 260
BUG 340
FAIL 007
total323232
casebashmkshoshdescription
0pass pass pass pass array by reference
1pass pass pass mutate array by reference
2pass BUG pass pass assoc array by reference
details
3pass BUG pass pass local array by reference, relying on DYNAMIC SCOPING
details
4pass pass pass flag -n and +n
5pass pass pass mutating through nameref: ref=
6pass N-I FAIL flag -n combined ${!ref} -- bash INVERTS
detailsdetails
7pass ok pass named ref with $# doesn't work
details
8N-I N-I pass named ref with $# and shopt -s strict_nameref
detailsdetails
9pass BUG pass named ref with 1 $1 etc.
details
10pass ok pass assign to invalid ref
details
11N-I N-I pass assign to invalid ref with strict_nameref
detailsdetails
12pass ok pass name ref on Undef cell
details
13pass ok pass assign to empty nameref and invalid nameref
details
14pass N-I pass -n attribute before it has a value
details
15BUG N-I pass -n attribute on array is hard error, not a warning
detailsdetails
16pass ok pass exported nameref
details
17pass pass pass readonly nameref doesn't prevent assigning through it
18ok ok pass readonly var can't be assigned through nameref
detailsdetails
19pass pass pass unset nameref
20pass pass pass Chain of namerefs
21BUG ok pass Mutually recursive namerefs detected on READ
detailsdetails
22BUG ok pass Mutually recursive namerefs detected on WRITE
detailsdetails
23pass pass pass Dynamic scope with namerefs
24pass pass pass change reference itself
25pass pass FAIL a[2] in nameref (eval_unsafe_arith)
details
26pass pass FAIL a[expr] in nameref (eval_unsafe_arith)
details
27pass ok FAIL a[@] in nameref (eval_unsafe_arith)
detailsdetails
28pass pass pass mutate through nameref: ref[0]=
29pass BUG FAIL bad mutation through nameref: ref[0]= where ref is array[0]
detailsdetails
30ok pass FAIL @ in nameref isn't supported, unlike in ${!ref}
detailsdetails
31pass N-I FAIL Unquoted assoc reference on RHS
detailsdetails
63 passed, 11 OK, 8 not implemented, 7 BUG, 7 failed, 0 timeouts, 0 cases skipped
7 failed under osh

Details on runs that didn't PASS

mksh2 pass assoc array by reference

stdout:
[monday]=eggs
stderr:
mksh3 pass local array by reference, relying on DYNAMIC SCOPING

stdout:
stderr: 
mksh: <stdin>[7]: syntax error: '(' unexpected
mksh6 flag -n combined ${!ref} -- bash INVERTS

stdout:
ref=x
!ref=ref
NOW A NAMEREF
ref=foo
!ref=x
stderr:
osh6 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:
mksh7 named ref with $# doesn't work

stdout:
ref=#
ref=3
stderr:
bash8 named ref with $# and shopt -s strict_nameref

stdout:
ref=#
ref=#
stderr:
bash: line 1: shopt: strict_nameref: invalid shell option name
bash: line 5: typeset: `#': invalid variable name for name reference
mksh8 named ref with $# and shopt -s strict_nameref

stdout:
ref=#
ref=0
stderr:
mksh: <stdin>[1]: shopt: not found
mksh9 named ref with 1 $1 etc.

stdout:
ref=1
ref=one
ref2=$1
stderr:
mksh: <stdin>[12]: ref2: empty nameref target
mksh10 assign to invalid ref

stdout:
ref=1
ref=
stderr:
mksh: <stdin>[7]: read-only: ref
bash11 assign to invalid ref with strict_nameref

stdout:
stderr: 
mksh11 assign to invalid ref with strict_nameref

stdout:
stderr: 
mksh12 name ref on Undef cell

stdout:
stderr: 
mksh: <stdin>[1]: ref: empty nameref target
mksh13 assign to empty nameref and invalid nameref

stdout:
stderr: 
mksh: <stdin>[1]: ref: empty nameref target
mksh14 -n attribute before it has a value

stdout:
stderr: 
mksh: <stdin>[1]: ref: empty nameref target
bash15 -n attribute on array is hard error, not a warning

stdout:
hi
ref=x
stderr:
bash: line 5: warning: ref: removing nameref attribute
mksh15 -n attribute on array is hard error, not a warning

stdout:
stderr: 
mksh: <stdin>[2]: ref: empty nameref target
mksh16 exported nameref

stdout:
None
None
---
foo
None
stderr:
bash18 readonly var can't be assigned through nameref

stdout:
ref=X
ref=XX
ref=XX
x=XX
stderr:
bash: line 11: x: readonly variable
mksh18 readonly var can't be assigned through nameref

stdout:
ref=X
ref=XX
stderr:
mksh: <stdin>[11]: read-only: ref
bash21 Mutually recursive namerefs detected on READ

stdout:
defined
ref1=
ref2=
stderr:
bash: line 4: warning: ref1: circular name reference
bash: line 5: warning: ref1: circular name reference
mksh21 Mutually recursive namerefs detected on READ

stdout:
stderr: 
mksh: <stdin>[2]: ref2: expression recurses on parameter
bash22 Mutually recursive namerefs detected on WRITE

stdout:
defined 0
mutated 1
stderr:
bash: line 4: warning: ref1: circular name reference
mksh22 Mutually recursive namerefs detected on WRITE

stdout:
stderr: 
mksh: <stdin>[2]: ref2: expression recurses on parameter
osh25 a[2] in nameref (eval_unsafe_arith)

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

stdout:
ref=a[2]
stderr:
osh26 a[expr] in nameref (eval_unsafe_arith)

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

stdout:
ref=a[$(echo 2) + 1]
stderr:
mksh27 a[@] in nameref (eval_unsafe_arith)

stdout:
stderr: 
mksh: <stdin>[1]: shopt: not found
mksh: <stdin>[5]: @: unexpected '@'
osh27 a[@] in nameref (eval_unsafe_arith)

[osh stdout] Expected "['ref', 'A B C']\nstatus=1\n['ref[@]']\n['ref', 'A B C']\n['a[@]', 'A B', 'C']\n", got "['ref', 'a[@]']\nstatus=0\n['ref[@]', 'X', 'Y', 'Z']\n"
[osh status] Expected 0, got 1

stdout:
['ref', 'a[@]']
status=0
['ref[@]', 'X', 'Y', 'Z']
stderr:
  argv.py ref "$ref"  # JOINING mangles the array?
               ^~~~
[ stdin ]:9: fatal: Array 'ref' can't be referred to as a scalar (without @ or *)
mksh29 bad mutation through nameref: ref[0]= where ref is array[0]

stdout:
status=0
foo Y Z
stderr:
osh29 bad mutation through nameref: ref[0]= where ref is array[0]

[osh stdout] Expected 'status=1\nX Y Z\n', got ''
[osh status] Expected 0, got 1

stdout:
stderr: 
  ref[0]=foo  # error in bash: 'array[0]': not a valid identifier
  ^~~~
[ stdin ]:3: fatal: Can't assign to items in a string
bash30 @ in nameref isn't supported, unlike in ${!ref}

stdout:
status=1
ref=
status=0
stderr:
bash: line 1: shopt: eval_unsafe_arith: invalid shell option name
bash: line 4: typeset: `@': invalid variable name for name reference
osh30 @ in nameref isn't supported, unlike in ${!ref}

[osh stdout] Expected u'', got 'status=0\nref=@\nstatus=0\n'
[osh status] Expected 1, got 0

stdout:
status=0
ref=@
status=0
stderr:
mksh31 Unquoted assoc reference on RHS

stdout:
stderr: 
mksh: <stdin>[1]: typeset: -A: unknown option
mksh: <stdin>[2]: 'foo': multi-character character constant
osh31 Unquoted assoc reference on RHS

[osh stdout] Expected "['bar']\n", got "['bashup_ev_r[foo]']\n"

stdout:
['bashup_ev_r[foo]']
stderr: