nameref () { run-file nameref "$@" } run-file () { local spec_name=$1; shift; sh-spec spec/$spec_name.test.sh --compare-shells --oils-bin-dir $PWD/bin "$@" }
spec test index / oilshell.org
63 passed, 11 OK, 8 not implemented, 7 BUG, 7 failed, 0 timeouts, 0 cases skipped 7 failed under osh
mksh | 2 pass assoc array by reference stdout: [monday]=eggsstderr: |
mksh | 3 pass local array by reference, relying on DYNAMIC SCOPING stdout: stderr: mksh: <stdin>[7]: syntax error: '(' unexpected |
mksh | 6 flag -n combined ${!ref} -- bash INVERTS stdout: ref=x !ref=ref NOW A NAMEREF ref=foo !ref=xstderr: |
osh | 6 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=FOOstderr: |
mksh | 7 named ref with $# doesn't work stdout: ref=# ref=3stderr: |
bash | 8 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 |
mksh | 8 named ref with $# and shopt -s strict_nameref stdout: ref=# ref=0stderr: mksh: <stdin>[1]: shopt: not found |
mksh | 9 named ref with 1 $1 etc. stdout: ref=1 ref=one ref2=$1stderr: mksh: <stdin>[12]: ref2: empty nameref target |
mksh | 10 assign to invalid ref stdout: ref=1 ref=stderr: mksh: <stdin>[7]: read-only: ref |
bash | 11 assign to invalid ref with strict_nameref stdout: stderr: |
mksh | 11 assign to invalid ref with strict_nameref stdout: stderr: |
mksh | 12 name ref on Undef cell stdout: stderr: mksh: <stdin>[1]: ref: empty nameref target |
mksh | 13 assign to empty nameref and invalid nameref stdout: stderr: mksh: <stdin>[1]: ref: empty nameref target |
mksh | 14 -n attribute before it has a value stdout: stderr: mksh: <stdin>[1]: ref: empty nameref target |
bash | 15 -n attribute on array is hard error, not a warning stdout: hi ref=xstderr: bash: line 5: warning: ref: removing nameref attribute |
mksh | 15 -n attribute on array is hard error, not a warning stdout: stderr: mksh: <stdin>[2]: ref: empty nameref target |
mksh | 16 exported nameref stdout: None None --- foo Nonestderr: |
bash | 18 readonly var can't be assigned through nameref stdout: ref=X ref=XX ref=XX x=XXstderr: bash: line 11: x: readonly variable |
mksh | 18 readonly var can't be assigned through nameref stdout: ref=X ref=XXstderr: mksh: <stdin>[11]: read-only: ref |
bash | 21 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 |
mksh | 21 Mutually recursive namerefs detected on READ stdout: stderr: mksh: <stdin>[2]: ref2: expression recurses on parameter |
bash | 22 Mutually recursive namerefs detected on WRITE stdout: defined 0 mutated 1stderr: bash: line 4: warning: ref1: circular name reference |
mksh | 22 Mutually recursive namerefs detected on WRITE stdout: stderr: mksh: <stdin>[2]: ref2: expression recurses on parameter |
osh | 25 a[2] in nameref [osh stdout] Expected 'ref=two\n', got 'ref=a[2]\n' stdout: ref=a[2]stderr: |
osh | 26 a[expr] in nameref [osh stdout] Expected 'ref=three\n', got 'ref=a[$(echo 2) + 1]\n' stdout: ref=a[$(echo 2) + 1]stderr: |
mksh | 27 a[@] in nameref stdout: stderr: mksh: <stdin>[3]: @: unexpected '@' |
osh | 27 a[@] in nameref [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['ref', 'X']\n['a[@]', 'A B', 'C']\n" stdout: ['ref', 'a[@]'] status=0 ['ref[@]', 'X', 'Y', 'Z'] ['ref', 'X'] ['a[@]', 'A B', 'C']stderr: |
mksh | 29 bad mutation through nameref: ref[0]= where ref is array[0] stdout: status=0 foo Y Zstderr: |
osh | 29 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 |
bash | 30 @ in nameref isn't supported, unlike in ${!ref} stdout: status=1 ref= status=0stderr: bash: line 2: typeset: `@': invalid variable name for name reference |
osh | 30 @ 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=0stderr: |
mksh | 31 Unquoted assoc reference on RHS stdout: stderr: mksh: <stdin>[1]: typeset: -A: unknown option mksh: <stdin>[2]: 'foo': multi-character character constant |
osh | 31 Unquoted assoc reference on RHS [osh stdout] Expected "['bar']\n", got "['bashup_ev_r[foo]']\n" stdout: ['bashup_ev_r[foo]']stderr: |