Results for var-sub.test.sh

casedashbashmkshoshdescription
0pass pass pass pass String length
1N-I pass pass FAIL Substring
detailsdetails
2N-I pass pass FAIL Cannot take length of substring
detailsdetails
3N-I pass pass FAIL Pattern replacement
detailsdetails
4pass pass pass FAIL Remove smallest suffix
details
5pass pass pass FAIL Remove longest suffix
details
6pass pass pass FAIL Remove smallest prefix
details
7pass pass pass FAIL Remove longest prefix
details
8pass pass pass pass Default value when empty
9pass pass pass pass Default value when unset
10pass pass pass FAIL Assign default value when empty
details
11pass pass pass FAIL Assign default value when unset
details
12pass pass pass FAIL Alternative value when empty
details
13pass pass pass FAIL Alternative value when unset
details
14ok pass pass pass Error when empty
details
15ok pass pass pass Error when unset
details
16pass pass pass FAIL Error when unset
details
17N-I pass pass FAIL String slice
detailsdetails
18N-I pass pass FAIL Negative string slice
detailsdetails
19N-I pass pass FAIL String slice with math
detailsdetails
20N-I pass BUG FAIL Var ref with ${!a}
detailsdetailsdetails
21N-I pass BUG FAIL Bad var ref with ${!a}
detailsdetailsdetails
22pass pass pass FAIL Local Var
details
23pass pass pass pass Nested ${}
24pass BUG pass pass Braced block inside ${}
details
25BUG pass pass pass Assigning $@ to var
details
26BUG pass pass FAIL Assigning "$@" to var
detailsdetails
27BUG pass pass FAIL Assigning "$@" to var, then showing it quoted
detailsdetails
28ok pass pass pass Filename redirect with "$@"
details
29ok pass ok FAIL Filename redirect with split word
detailsdetailsdetails
30pass ok ok FAIL Descriptor redirect to bad "$@"
detailsdetailsdetails
31pass pass ok FAIL Here doc with bad "$@" delimiter
detailsdetails

83 passed, 8 ok, 8 known unimplemented, 6 known bugs, 23 failed, 0 skipped

Details on runs that didn't PASS

dash1 Substring

stdout:
stderr: 
/bin/dash: 2: Bad substitution
osh1 Substring

[osh stdout] Expected b'bcd\n', got b''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 378, in <module>
    sys.exit(main(sys.argv))
  File "bin/osh", line 368, in main
    return OshMain(main_argv)
  File "bin/osh", line 327, in OshMain
    status, cflow = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 758, in Execute
    status, cflow = self.Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 659, in Execute
    argv = self.ev.EvalWords(node.words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 791, in EvalWords
    ok, val = self.EvalCompoundWord(w, ifs=ifs, do_glob=do_glob)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 580, in EvalCompoundWord
    ok, val = self.EvalWordPart(p, quoted=False)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 705, in EvalWordPart
    return self.EvalVarSub(part, quoted=quoted)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 414, in EvalVarSub
    if part.suffix_op and LookupKind(part.suffix_op.op_id) == Kind.VTest:
AttributeError: 'Slice' object has no attribute 'op_id'
dash2 Cannot take length of substring

stdout:
5
stderr:
osh2 Cannot take length of substring

[osh status] Expected 1, got 2

stdout:
<core.base.ParseError object at 0x7f3727b464a8>
Line 2 of '<stdin>'
  echo ${#v:1:3}
           ^
---
<core.base.ParseError object at 0x7f3727b46358>
Line 2 of '<stdin>'
  echo ${#v:1:3}
           ^
---
<core.base.ParseError object at 0x7f3727b46470>
Line 0 of '<unknown>'
  <token had no position info>
NO COL
---
stderr:
Expected } after length expression, got (token id:VOp2_Colon val:":" span_id:8)
Error reading command word
Error parsing AndOr in ParseCommandTerm
dash3 Pattern replacement

stdout:
stderr: 
/bin/dash: 2: Bad substitution
osh3 Pattern replacement

[osh stdout] Expected b'abXX\n', got b''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 378, in <module>
    sys.exit(main(sys.argv))
  File "bin/osh", line 368, in main
    return OshMain(main_argv)
  File "bin/osh", line 327, in OshMain
    status, cflow = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 758, in Execute
    status, cflow = self.Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 659, in Execute
    argv = self.ev.EvalWords(node.words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 791, in EvalWords
    ok, val = self.EvalCompoundWord(w, ifs=ifs, do_glob=do_glob)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 580, in EvalCompoundWord
    ok, val = self.EvalWordPart(p, quoted=False)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 705, in EvalWordPart
    return self.EvalVarSub(part, quoted=quoted)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 414, in EvalVarSub
    if part.suffix_op and LookupKind(part.suffix_op.op_id) == Kind.VTest:
AttributeError: 'PatSub' object has no attribute 'op_id'
osh4 Remove smallest suffix

[osh stdout] Expected b'aabbc\n', got b''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 378, in <module>
    sys.exit(main(sys.argv))
  File "bin/osh", line 368, in main
    return OshMain(main_argv)
  File "bin/osh", line 327, in OshMain
    status, cflow = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 758, in Execute
    status, cflow = self.Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 659, in Execute
    argv = self.ev.EvalWords(node.words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 791, in EvalWords
    ok, val = self.EvalCompoundWord(w, ifs=ifs, do_glob=do_glob)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 580, in EvalCompoundWord
    ok, val = self.EvalWordPart(p, quoted=False)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 705, in EvalWordPart
    return self.EvalVarSub(part, quoted=quoted)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 510, in EvalVarSub
    print(op.words)
AttributeError: 'StringUnary' object has no attribute 'words'
osh5 Remove longest suffix

[osh stdout] Expected b'aabb\n', got b'aabbccdd\n'

stdout:
aabbccdd
stderr:
osh6 Remove smallest prefix

[osh stdout] Expected b'bccdd\n', got b'aabbccdd\n'

stdout:
aabbccdd
stderr:
osh7 Remove longest prefix

[osh stdout] Expected b'ccdd\n', got b'aabbccdd\n'

stdout:
aabbccdd
stderr:
osh10 Assign default value when empty

[osh stdout] Expected b'is empty\n', got b''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 378, in <module>
    sys.exit(main(sys.argv))
  File "bin/osh", line 368, in main
    return OshMain(main_argv)
  File "bin/osh", line 327, in OshMain
    status, cflow = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 758, in Execute
    status, cflow = self.Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 659, in Execute
    argv = self.ev.EvalWords(node.words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 791, in EvalWords
    ok, val = self.EvalCompoundWord(w, ifs=ifs, do_glob=do_glob)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 580, in EvalCompoundWord
    ok, val = self.EvalWordPart(p, quoted=False)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 705, in EvalWordPart
    return self.EvalVarSub(part, quoted=quoted)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 444, in EvalVarSub
    raise NotImplementedError(id)
NotImplementedError: <built-in function id>
osh11 Assign default value when unset

[osh stdout] Expected b'is unset\n', got b''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 378, in <module>
    sys.exit(main(sys.argv))
  File "bin/osh", line 368, in main
    return OshMain(main_argv)
  File "bin/osh", line 327, in OshMain
    status, cflow = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 758, in Execute
    status, cflow = self.Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 659, in Execute
    argv = self.ev.EvalWords(node.words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 791, in EvalWords
    ok, val = self.EvalCompoundWord(w, ifs=ifs, do_glob=do_glob)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 580, in EvalCompoundWord
    ok, val = self.EvalWordPart(p, quoted=False)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 705, in EvalWordPart
    return self.EvalVarSub(part, quoted=quoted)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 444, in EvalVarSub
    raise NotImplementedError(id)
NotImplementedError: <built-in function id>
osh12 Alternative value when empty

[osh stdout] Expected b'v is not empty\n', got b''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 378, in <module>
    sys.exit(main(sys.argv))
  File "bin/osh", line 368, in main
    return OshMain(main_argv)
  File "bin/osh", line 327, in OshMain
    status, cflow = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 758, in Execute
    status, cflow = self.Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 659, in Execute
    argv = self.ev.EvalWords(node.words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 791, in EvalWords
    ok, val = self.EvalCompoundWord(w, ifs=ifs, do_glob=do_glob)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 580, in EvalCompoundWord
    ok, val = self.EvalWordPart(p, quoted=False)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 705, in EvalWordPart
    return self.EvalVarSub(part, quoted=quoted)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 444, in EvalVarSub
    raise NotImplementedError(id)
NotImplementedError: <built-in function id>
osh13 Alternative value when unset

[osh stdout] Expected b'v is not unset\n', got b''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 378, in <module>
    sys.exit(main(sys.argv))
  File "bin/osh", line 368, in main
    return OshMain(main_argv)
  File "bin/osh", line 327, in OshMain
    status, cflow = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 758, in Execute
    status, cflow = self.Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 659, in Execute
    argv = self.ev.EvalWords(node.words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 791, in EvalWords
    ok, val = self.EvalCompoundWord(w, ifs=ifs, do_glob=do_glob)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 580, in EvalCompoundWord
    ok, val = self.EvalWordPart(p, quoted=False)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 705, in EvalWordPart
    return self.EvalVarSub(part, quoted=quoted)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 444, in EvalVarSub
    raise NotImplementedError(id)
NotImplementedError: <built-in function id>
dash14 Error when empty

stdout:
stderr: 
/bin/dash: 2: empty: is empty
dash15 Error when unset

stdout:
stderr: 
/bin/dash: 1: unset: is empty
osh16 Error when unset

[osh stdout] Expected b'v is not unset\n', got b''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 378, in <module>
    sys.exit(main(sys.argv))
  File "bin/osh", line 368, in main
    return OshMain(main_argv)
  File "bin/osh", line 327, in OshMain
    status, cflow = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 758, in Execute
    status, cflow = self.Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 659, in Execute
    argv = self.ev.EvalWords(node.words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 791, in EvalWords
    ok, val = self.EvalCompoundWord(w, ifs=ifs, do_glob=do_glob)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 580, in EvalCompoundWord
    ok, val = self.EvalWordPart(p, quoted=False)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 705, in EvalWordPart
    return self.EvalVarSub(part, quoted=quoted)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 444, in EvalVarSub
    raise NotImplementedError(id)
NotImplementedError: <built-in function id>
dash17 String slice

stdout:
stderr: 
/bin/dash: 2: Bad substitution
osh17 String slice

[osh stdout] Expected b'bcd\n', got b''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 378, in <module>
    sys.exit(main(sys.argv))
  File "bin/osh", line 368, in main
    return OshMain(main_argv)
  File "bin/osh", line 327, in OshMain
    status, cflow = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 758, in Execute
    status, cflow = self.Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 659, in Execute
    argv = self.ev.EvalWords(node.words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 791, in EvalWords
    ok, val = self.EvalCompoundWord(w, ifs=ifs, do_glob=do_glob)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 580, in EvalCompoundWord
    ok, val = self.EvalWordPart(p, quoted=False)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 705, in EvalWordPart
    return self.EvalVarSub(part, quoted=quoted)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 414, in EvalVarSub
    if part.suffix_op and LookupKind(part.suffix_op.op_id) == Kind.VTest:
AttributeError: 'Slice' object has no attribute 'op_id'
dash18 Negative string slice

stdout:
stderr: 
/bin/dash: 2: Bad substitution
osh18 Negative string slice

[osh stdout] Expected b'def\n', got b''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 378, in <module>
    sys.exit(main(sys.argv))
  File "bin/osh", line 368, in main
    return OshMain(main_argv)
  File "bin/osh", line 327, in OshMain
    status, cflow = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 758, in Execute
    status, cflow = self.Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 659, in Execute
    argv = self.ev.EvalWords(node.words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 791, in EvalWords
    ok, val = self.EvalCompoundWord(w, ifs=ifs, do_glob=do_glob)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 580, in EvalCompoundWord
    ok, val = self.EvalWordPart(p, quoted=False)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 705, in EvalWordPart
    return self.EvalVarSub(part, quoted=quoted)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 414, in EvalVarSub
    if part.suffix_op and LookupKind(part.suffix_op.op_id) == Kind.VTest:
AttributeError: 'Slice' object has no attribute 'op_id'
dash19 String slice with math

stdout:
stderr: 
/bin/dash: 3: Bad substitution
osh19 String slice with math

[osh stdout] Expected b'def\n', got b''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 378, in <module>
    sys.exit(main(sys.argv))
  File "bin/osh", line 368, in main
    return OshMain(main_argv)
  File "bin/osh", line 327, in OshMain
    status, cflow = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 758, in Execute
    status, cflow = self.Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 659, in Execute
    argv = self.ev.EvalWords(node.words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 791, in EvalWords
    ok, val = self.EvalCompoundWord(w, ifs=ifs, do_glob=do_glob)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 580, in EvalCompoundWord
    ok, val = self.EvalWordPart(p, quoted=False)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 705, in EvalWordPart
    return self.EvalVarSub(part, quoted=quoted)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 414, in EvalVarSub
    if part.suffix_op and LookupKind(part.suffix_op.op_id) == Kind.VTest:
AttributeError: 'Slice' object has no attribute 'op_id'
dash20 Var ref with ${!a}

stdout:
stderr: 
/bin/dash: 3: Bad substitution
mksh20 Var ref with ${!a}

stdout:
ref a
stderr:
osh20 Var ref with ${!a}

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

stdout:
ref b
stderr:
dash21 Bad var ref with ${!a}

stdout:
stderr: 
/bin/dash: 2: Bad substitution
mksh21 Bad var ref with ${!a}

stdout:
ref a
stderr:
osh21 Bad var ref with ${!a}

[osh stdout] Expected b'ref\n', got b'ref bad var name\n'

stdout:
ref bad var name
stderr:
osh22 Local Var

[osh stdout] Expected b'INNER 5 6\nOUTER\n', got b'INNER 5 6\n'

stdout:
INNER 5 6
stderr:
Traceback (most recent call last):
  File "bin/osh", line 378, in <module>
    sys.exit(main(sys.argv))
  File "bin/osh", line 368, in main
    return OshMain(main_argv)
  File "bin/osh", line 327, in OshMain
    status, cflow = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 758, in Execute
    status, cflow = self.Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 663, in Execute
    raise AssertionError('Error evaluating words: %s' % err)
AssertionError: Error evaluating words: ['Undefined variable f_var', 'Error evaluating word part (SimpleVarSub token:(token id:VSub_Name val:"$f_var" span_id:48))', 'Error evaluating word (CompoundWord parts:[(SimpleVarSub token:(token id:VSub_Name val:"$f_var" span_id:48))])']
bash24 Braced block inside ${}

stdout:
stderr: 
/bin/bash: line 1: syntax error near unexpected token `)'
/bin/bash: line 1: `echo ${foo:-$({ which ls; })}'
dash25 Assigning $@ to var

stdout:
stderr: 
/bin/dash: 2: local: 2: bad variable name
dash26 Assigning "$@" to var

stdout:
stderr: 
/bin/dash: 2: local: 2 3: bad variable name
osh26 Assigning "$@" to var

[osh stdout] Expected b"['1', '2', '3']\n", got b"['1', '2 3']\n"

stdout:
['1', '2 3']
stderr:
dash27 Assigning "$@" to var, then showing it quoted

stdout:
stderr: 
/bin/dash: 2: local: 2 3: bad variable name
osh27 Assigning "$@" to var, then showing it quoted

[osh stdout] Expected b"['1 2 3']\n", got b"['1', '2 3']\n"

stdout:
['1', '2 3']
stderr:
dash28 Filename redirect with "$@"

stdout:
stderr: 
/bin/dash: 2: cannot create _tmp/var-sub1 _tmp/var-sub2: Directory nonexistent
dash29 Filename redirect with split word

stdout:
hi
stderr:
mksh29 Filename redirect with split word

stdout:
hi
stderr:
rm: cannot remove ‘_tmp/1 2’: No such file or directory
osh29 Filename redirect with split word

[osh status] Expected 1, got 0

stdout:
hi
stderr:
bash30 Descriptor redirect to bad "$@"

stdout:
stderr: 
/bin/bash: line 2: "$@": ambiguous redirect
mksh30 Descriptor redirect to bad "$@"

stdout:
stderr: 
/bin/mksh: <stdin>[2]: >&'2 3 c d' : illegal file descriptor name
osh30 Descriptor redirect to bad "$@"

[osh status] Expected 2, got 1

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 378, in <module>
    sys.exit(main(sys.argv))
  File "bin/osh", line 368, in main
    return OshMain(main_argv)
  File "bin/osh", line 327, in OshMain
    status, cflow = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 758, in Execute
    status, cflow = self.Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 686, in Execute
    for r in redirects:
TypeError: 'bool' object is not iterable
mksh31 Here doc with bad "$@" delimiter

stdout:
stderr: 
/bin/mksh: <stdin>[7]: here document '$@' unclosed
osh31 Here doc with bad "$@" delimiter

[osh stdout] Expected b'', got b'<core.base.ParseError object at 0x7f0152334400>\nLine 2 of \'<stdin>\'\n cat << "$@"\n ^~\n---\n<core.base.ParseError object at 0x7f0152334358>\nLine 0 of \'<unknown>\'\n <token had no position info>\nNO COL\n---\n<core.base.ParseError object at 0x7f015231df98>\nLine 0 of \'<unknown>\'\n <token had no position info>\nNO COL\n---\n'

stdout:
<core.base.ParseError object at 0x7f0152334400>
Line 2 of '<stdin>'
    cat << "$@"
            ^~
---
<core.base.ParseError object at 0x7f0152334358>
Line 0 of '<unknown>'
  <token had no position info>
NO COL
---
<core.base.ParseError object at 0x7f015231df98>
Line 0 of '<unknown>'
  <token had no position info>
NO COL
---
stderr:
Error evaluating here doc delimiter: (CompoundWord
  parts: [
    (DoubleQuotedPart
      parts: [(SimpleVarSub token:(token id:VSub_At val:"$@" span_id:12))]
      spids: [11 13]
    )
  ]
)
Error parsing AndOr in ParseCommandTerm
Error parsing AndOr in ParseCommandTerm