Results for arith.test.sh

casedashbashmkshzshoshdescription
0pass pass pass pass pass Add one to var
1pass pass pass pass pass $ is optional
2N-I pass pass pass FAIL Bizarre recursive evaluation rule
detailsdetails
3pass pass pass pass pass Can use Braced VarSub within ArithSub
4pass pass pass pass pass Arith word part
5pass pass pass pass pass Arith sub with word parts
6N-I N-I pass N-I pass Constant with quotes like '1'
detailsdetailsdetails
7pass pass pass pass pass Arith sub within arith sub
8pass pass pass pass pass Backticks within arith sub
9ok BUG BUG BUG pass Bad variable substitution
detailsdetailsdetailsdetails
10ok BUG BUG BUG pass Two bad variable substitutions
detailsdetailsdetailsdetails
11pass pass pass pass pass Newline in the middle of expression
12pass pass pass pass FAIL Ternary operator
details
13N-I pass pass pass FAIL Preincrement
detailsdetails
14N-I pass pass pass FAIL Postincrement
detailsdetails
15N-I pass pass pass pass Comma operator (borrowed from C)
details
16pass pass pass pass FAIL Mutating ops
details
17pass pass pass pass FAIL Bitwise ops
details
18pass pass pass pass pass Unary minus and plus
19ok pass pass BUG FAIL No floating point
detailsdetailsdetails
20N-I pass pass ok FAIL Array indexing in arith
detailsdetailsdetails
21N-I pass pass pass pass Constants in base 36
details
22N-I pass N-I N-I pass Constants in bases 2 to 64
detailsdetailsdetails
23N-I pass pass pass pass Dynamic base constants
details
24pass pass N-I N-I pass Octal constant
detailsdetails
25pass pass N-I N-I pass Dynamic octal constant
detailsdetails
26pass pass pass pass pass Dynamic hex constants
27pass pass pass pass FAIL Dynamic var names!
details

103 passed, 4 ok, 17 known unimplemented, 7 known bugs, 9 failed, 0 skipped

Details on runs that didn't PASS

dash2 Bizarre recursive evaluation rule

stdout:
stderr: 
/bin/dash: 5: Illegal number: foo
osh2 Bizarre recursive evaluation rule

[osh stdout] Expected b'6 6 6 6\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 663, in Execute
    raise AssertionError('Error evaluating words: %s' % err)
AssertionError: Error evaluating words: ["Invalid integer constant 'foo'", '', 'Error evaluating word part (ArithSubPart\n  anode: \n    (ArithBinary\n      op_id: Arith_Plus\n      left: (RightVar name:bar)\n      right: \n        (ArithWord\n          w: (CompoundWord parts:[(LiteralPart token:(token id:Lit_Digits val:1 span_id:24))])\n        )\n    )\n  spids: [21 26]\n)', 'Error evaluating word (CompoundWord\n  parts: [\n    (ArithSubPart\n      anode: \n        (ArithBinary\n          op_id: Arith_Plus\n          left: (RightVar name:bar)\n          right: \n            (ArithWord\n              w: (CompoundWord parts:[(LiteralPart token:(token id:Lit_Digits val:1 span_id:24))])\n            )\n        )\n      spids: [21 26]\n    )\n  ]\n)']
dash6 Constant with quotes like '1'

stdout:
stderr: 
/bin/dash: 1: arithmetic expression: expecting primary: "'1' + 2"
bash6 Constant with quotes like '1'

stdout:
stderr: 
/bin/bash: line 1: '1' + 2: syntax error: operand expected (error token is "'1' + 2")
zsh6 Constant with quotes like '1'

stdout:
stderr: 
zsh: bad math expression: illegal character: '
dash9 Bad variable substitution

stdout:
stderr: 
/bin/dash: 2: Illegal number: foo
bash9 Bad variable substitution

stdout:
5
stderr:
mksh9 Bad variable substitution

stdout:
5
stderr:
zsh9 Bad variable substitution

stdout:
5
stderr:
dash10 Two bad variable substitutions

stdout:
stderr: 
/bin/dash: 3: Illegal number: foo
bash10 Two bad variable substitutions

stdout:
0
stderr:
mksh10 Two bad variable substitutions

stdout:
0
stderr:
zsh10 Two bad variable substitutions

stdout:
0
stderr:
osh12 Ternary operator

[osh stdout] Expected b'10\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 713, in EvalWordPart
    return self.EvalArithSub(part.anode)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 228, in EvalArithSub
    if arith_ev.Eval(anode):
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 64, in Eval
    result = self._Eval(node)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 202, in _Eval
    lhs = self._Eval(node.cond)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 239, in _Eval
    raise AssertionError("Shouldn't get here")
AssertionError: Shouldn't get here
dash13 Preincrement

stdout:
4
4
stderr:
osh13 Preincrement

[osh stdout] Expected b'5\n5\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 713, in EvalWordPart
    return self.EvalArithSub(part.anode)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 228, in EvalArithSub
    if arith_ev.Eval(anode):
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 64, in Eval
    result = self._Eval(node)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 239, in _Eval
    raise AssertionError("Shouldn't get here")
AssertionError: Shouldn't get here
dash14 Postincrement

stdout:
stderr: 
/bin/dash: 2: arithmetic expression: expecting primary: "a++"
osh14 Postincrement

[osh stdout] Expected b'4\n5\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 713, in EvalWordPart
    return self.EvalArithSub(part.anode)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 228, in EvalArithSub
    if arith_ev.Eval(anode):
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 64, in Eval
    result = self._Eval(node)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 239, in _Eval
    raise AssertionError("Shouldn't get here")
AssertionError: Shouldn't get here
dash15 Comma operator (borrowed from C)

stdout:
stderr: 
/bin/dash: 3: arithmetic expression: expecting EOF: "a,(b+1)"
osh16 Mutating ops

[osh stdout] Expected b'5\n5\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 713, in EvalWordPart
    return self.EvalArithSub(part.anode)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 228, in EvalArithSub
    if arith_ev.Eval(anode):
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 64, in Eval
    result = self._Eval(node)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 237, in _Eval
    raise AssertionError("Invalid node %r" % node.id)
AttributeError: 'ArithAssign' object has no attribute 'id'
osh17 Bitwise ops

[osh stdout] Expected b'3\n0\n-4\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 713, in EvalWordPart
    return self.EvalArithSub(part.anode)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 228, in EvalArithSub
    if arith_ev.Eval(anode):
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 64, in Eval
    result = self._Eval(node)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 239, in _Eval
    raise AssertionError("Shouldn't get here")
AssertionError: Shouldn't get here
dash19 No floating point

stdout:
stderr: 
/bin/dash: 1: arithmetic expression: expecting EOF: "1 + 2.3"
zsh19 No floating point

stdout:
3.2999999999999998
stderr:
osh19 No floating point

[osh status] Expected 1, got 2

stdout:
<core.base.ParseError object at 0x7fdc893a1470>
Line 1 of '<stdin>'
  echo $((1 + 2.3))
               ^
---
<core.base.ParseError object at 0x7fdc893a1470>
Line 1 of '<stdin>'
  echo $((1 + 2.3))
               ^
---
<core.base.ParseError object at 0x7fdc893a14a8>
Line 0 of '<unknown>'
  <token had no position info>
NO COL
---
<core.base.ParseError object at 0x7fdc893a14e0>
Line 0 of '<unknown>'
  <token had no position info>
NO COL
---
<core.base.ParseError object at 0x7fdc893a1160>
Line 0 of '<unknown>'
  <token had no position info>
NO COL
---
<core.base.ParseError object at 0x7fdc893a1128>
Line 1 of '<stdin>'
  echo $((1 + 2.3))
               ^
---
<core.base.ParseError object at 0x7fdc893a12e8>
Line 0 of '<unknown>'
  <token had no position info>
NO COL
---
stderr:
Unknown token in arith context: (token id:Unknown_Tok val:. span_id:8)
Unknown token in arith context: (token id:Unknown_Tok val:. span_id:8)
Error reading arith word in ArithParser

Error parsing arith sub part
Error reading command word
Error parsing AndOr in ParseCommandTerm
dash20 Array indexing in arith

stdout:
stderr: 
/bin/dash: 1: Syntax error: "(" unexpected
zsh20 Array indexing in arith

stdout:
7
stderr:
osh20 Array indexing in arith

[osh stdout] Expected b'11\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 663, in Execute
    raise AssertionError('Error evaluating words: %s' % err)
AssertionError: Error evaluating words: ['', 'Error evaluating word part (ArithSubPart\n  anode: \n    (ArithBinary\n      op_id: Arith_Plus\n      left: \n        (ArithBinary\n          op_id: Arith_LBracket\n          left: (RightVar name:array)\n          right: \n            (ArithWord\n              w: (CompoundWord parts:[(LiteralPart token:(token id:Lit_Digits val:1 span_id:16))])\n            )\n        )\n      right: \n        (ArithBinary\n          op_id: Arith_Star\n          left: \n            (ArithBinary\n              op_id: Arith_LBracket\n              left: (RightVar name:array)\n              right: \n                (ArithWord\n                  w: \n                    (CompoundWord\n                      parts: [(LiteralPart token:(token id:Lit_Digits val:2 span_id:23))]\n                    )\n                )\n            )\n          right: \n            (ArithWord\n              w: (CompoundWord parts:[(LiteralPart token:(token id:Lit_Digits val:3 span_id:26))])\n            )\n        )\n    )\n  spids: [13 28]\n)', 'Error evaluating word (CompoundWord\n  parts: [\n    (ArithSubPart\n      anode: \n        (ArithBinary\n          op_id: Arith_Plus\n          left: \n            (ArithBinary\n              op_id: Arith_LBracket\n              left: (RightVar name:array)\n              right: \n                (ArithWord\n                  w: \n                    (CompoundWord\n                      parts: [(LiteralPart token:(token id:Lit_Digits val:1 span_id:16))]\n                    )\n                )\n            )\n          right: \n            (ArithBinary\n              op_id: Arith_Star\n              left: \n                (ArithBinary\n                  op_id: Arith_LBracket\n                  left: (RightVar name:array)\n                  right: \n                    (ArithWord\n                      w: \n                        (CompoundWord\n                          parts: [(LiteralPart token:(token id:Lit_Digits val:2 span_id:23))]\n                        )\n                    )\n                )\n              right: \n                (ArithWord\n                  w: \n                    (CompoundWord\n                      parts: [(LiteralPart token:(token id:Lit_Digits val:3 span_id:26))]\n                    )\n                )\n            )\n        )\n      spids: [13 28]\n    )\n  ]\n)']
dash21 Constants in base 36

stdout:
stderr: 
/bin/dash: 1: arithmetic expression: expecting EOF: "36#a"
dash22 Constants in bases 2 to 64

stdout:
stderr: 
/bin/dash: 1: arithmetic expression: expecting EOF: "64#a"
mksh22 Constants in bases 2 to 64

stdout:
stderr: 
/bin/mksh: <stdin>[1]: 64#a: bad number '64#a'
zsh22 Constants in bases 2 to 64

stdout:
stderr: 
zsh: invalid base (must be 2 to 36 inclusive): 64
dash23 Dynamic base constants

stdout:
stderr: 
/bin/dash: 2: arithmetic expression: expecting EOF: " 16#a "
mksh24 Octal constant

stdout:
11
stderr:
zsh24 Octal constant

stdout:
11
stderr:
mksh25 Dynamic octal constant

stdout:
11
stderr:
zsh25 Dynamic octal constant

stdout:
11
stderr:
osh27 Dynamic var names!

[osh stdout] Expected b'11\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 663, in Execute
    raise AssertionError('Error evaluating words: %s' % err)
AssertionError: Error evaluating words: ["Invalid integer constant 'foo'", '', 'Error evaluating word part (ArithSubPart\n  anode: \n    (ArithBinary\n      op_id: Arith_Plus\n      left: \n        (ArithBinary\n          op_id: Arith_Plus\n          left: (RightVar name:foo)\n          right: \n            (ArithWord\n              w: \n                (CompoundWord\n                  parts: [\n                    (LiteralPart\n                      token: (token id:Lit_ArithVarLike val:f span_id:14)\n                    )\n                    (SimpleVarSub token:(token id:VSub_Name val:"$x" span_id:15))\n                  ]\n                )\n            )\n        )\n      right: \n        (ArithWord\n          w: (CompoundWord parts:[(LiteralPart token:(token id:Lit_Digits val:1 span_id:19))])\n        )\n    )\n  spids: [8 22]\n)', 'Error evaluating word (CompoundWord\n  parts: [\n    (ArithSubPart\n      anode: \n        (ArithBinary\n          op_id: Arith_Plus\n          left: \n            (ArithBinary\n              op_id: Arith_Plus\n              left: (RightVar name:foo)\n              right: \n                (ArithWord\n                  w: \n                    (CompoundWord\n                      parts: [\n                        (LiteralPart\n                          token: (token id:Lit_ArithVarLike val:f span_id:14)\n                        )\n                        (SimpleVarSub\n                          token: (token id:VSub_Name val:"$x" span_id:15)\n                        )\n                      ]\n                    )\n                )\n            )\n          right: \n            (ArithWord\n              w: (CompoundWord parts:[(LiteralPart token:(token id:Lit_Digits val:1 span_id:19))])\n            )\n        )\n      spids: [8 22]\n    )\n  ]\n)']