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 = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 937, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 828, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 716, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 962, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 945, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 906, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 799, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 735, in _EvalWordPart
    self.error_stack.extend(arith_ev.Error())
AttributeError: '_NormalPartEvaluator' object has no attribute 'error_stack'
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 = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 937, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 828, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 716, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 962, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 945, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 906, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 799, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 731, in _EvalWordPart
    if arith_ev.Eval(part.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 201, in _Eval
    lhs = self._Eval(node.cond)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 238, 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 = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 937, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 828, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 716, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 962, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 945, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 906, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 799, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 731, in _EvalWordPart
    if arith_ev.Eval(part.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 238, 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 = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 937, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 828, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 716, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 962, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 945, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 906, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 799, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 731, in _EvalWordPart
    if arith_ev.Eval(part.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 238, 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 = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 937, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 828, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 716, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 962, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 945, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 906, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 799, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 731, in _EvalWordPart
    if arith_ev.Eval(part.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 236, 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 = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 937, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 828, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 716, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 962, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 945, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 906, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 799, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 731, in _EvalWordPart
    if arith_ev.Eval(part.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 238, 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:
stderr: 
Line 1 of '<stdin>'
  echo $((1 + 2.3))
               ^
Unknown token in arith context: (token id:Unknown_Tok val:. span_id:8)
---
Line 1 of '<stdin>'
  echo $((1 + 2.3))
               ^
Unknown token in arith context: (token id:Unknown_Tok val:. span_id:8)
---
Line 0 of '<unknown>'
  <token had no position info>
NO COL
Error reading arith word in ArithParser
---
Line 0 of '<unknown>'
  <token had no position info>
NO COL

---
Line 0 of '<unknown>'
  <token had no position info>
NO COL
Error parsing arith sub part
---
Line 1 of '<stdin>'
  echo $((1 + 2.3))
               ^
Error reading command word
---
Line 0 of '<unknown>'
  <token had no position info>
NO COL
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 = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 937, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 828, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 716, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 962, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 945, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 906, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 799, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 735, in _EvalWordPart
    self.error_stack.extend(arith_ev.Error())
AttributeError: '_NormalPartEvaluator' object has no attribute 'error_stack'
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 = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 937, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 828, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 716, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 962, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 945, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 906, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 799, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 735, in _EvalWordPart
    self.error_stack.extend(arith_ev.Error())
AttributeError: '_NormalPartEvaluator' object has no attribute 'error_stack'