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 SimpleVarSub within arith
4pass pass pass pass pass BracedVarSub within ArithSub
5pass pass pass pass pass Arith word part
6pass pass pass pass pass Arith sub with word parts
7N-I N-I pass N-I pass Constant with quotes like '1'
detailsdetailsdetails
8pass pass pass pass pass Arith sub within arith sub
9pass pass pass pass pass Backticks within arith sub
10ok ok ok ok ok Invalid string to int
detailsdetailsdetailsdetailsdetails
11N-I N-I N-I N-I pass Invalid string to int with strict-arith
detailsdetailsdetailsdetails
12pass pass pass pass pass Newline in the middle of expression
13pass pass pass pass FAIL Ternary operator
details
14N-I pass pass pass FAIL Preincrement
detailsdetails
15N-I pass pass pass FAIL Postincrement
detailsdetails
16N-I pass pass pass pass Comma operator (borrowed from C)
details
17pass pass pass pass FAIL Mutating ops
details
18pass pass pass pass FAIL Bitwise ops
details
19pass pass pass pass pass Unary minus and plus
20ok pass pass BUG FAIL No floating point
detailsdetailsdetails
21N-I pass pass ok FAIL Array indexing in arith
detailsdetailsdetails
22N-I pass pass pass pass Constants in base 36
details
23N-I pass N-I N-I pass Constants in bases 2 to 64
detailsdetailsdetails
24N-I pass pass pass pass Dynamic base constants
details
25pass pass N-I N-I pass Octal constant
detailsdetails
26pass pass N-I N-I pass Dynamic octal constant
detailsdetails
27pass pass pass pass pass Dynamic hex constants
28pass pass pass pass FAIL Dynamic var names!
details
29BUG pass BUG BUG pass nounset with arithmetic
detailsdetailsdetails

109 passed, 7 ok, 21 known unimplemented, 4 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 '6 6 6 6\n', got '6 1 1 1\n'

stdout:
6 1 1 1
stderr:
osh warning: Invalid integer constant 'foo'
osh warning: Invalid integer constant 'bar'
osh warning: Invalid integer constant 'spam'
dash7 Constant with quotes like '1'

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

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

stdout:
stderr: 
zsh: bad math expression: illegal character: '
dash10 Invalid string to int

stdout:
stderr: 
/bin/dash: 2: Illegal number: foo
bash10 Invalid string to int

stdout:
5
stderr:
mksh10 Invalid string to int

stdout:
5
stderr:
zsh10 Invalid string to int

stdout:
5
stderr:
osh10 Invalid string to int

stdout:
5
stderr:
osh warning: Invalid integer constant 'foo'
dash11 Invalid string to int with strict-arith

stdout:
stderr: 
/bin/dash: 1: set: Illegal option -o strict-arith
bash11 Invalid string to int with strict-arith

stdout:
foo
5
stderr:
/bin/bash: line 1: set: strict-arith: invalid option name
mksh11 Invalid string to int with strict-arith

stdout:
stderr: 
/bin/mksh: <stdin>[1]: set: strict-arith: bad option
zsh11 Invalid string to int with strict-arith

stdout:
stderr: 
set: no such option: strict-arith
osh13 Ternary operator

[osh stdout] Expected '10\n', got ''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 430, in <module>
    main(sys.argv)
  File "bin/osh", line 417, in main
    sys.exit(OilMain(argv))
  File "bin/osh", line 400, in OilMain
    status = OshMain(main_argv)
  File "bin/osh", line 359, in OshMain
    status = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 1212, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 1057, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 962, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 1024, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 1004, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 957, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 853, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 811, in _EvalWordPart
    num = arith_ev.Eval(part.anode)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 129, in Eval
    return self._Eval(node)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 191, in _Eval
    lhs = self._Eval(node.cond)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 234, in _Eval
    raise AssertionError("Shouldn't get here")
AssertionError: Shouldn't get here
dash14 Preincrement

stdout:
4
4
stderr:
osh14 Preincrement

[osh stdout] Expected u'5\n5\n', got ''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 430, in <module>
    main(sys.argv)
  File "bin/osh", line 417, in main
    sys.exit(OilMain(argv))
  File "bin/osh", line 400, in OilMain
    status = OshMain(main_argv)
  File "bin/osh", line 359, in OshMain
    status = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 1212, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 1057, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 962, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 1024, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 1004, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 957, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 853, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 811, in _EvalWordPart
    num = arith_ev.Eval(part.anode)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 129, in Eval
    return self._Eval(node)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 234, in _Eval
    raise AssertionError("Shouldn't get here")
AssertionError: Shouldn't get here
dash15 Postincrement

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

[osh stdout] Expected u'4\n5\n', got ''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 430, in <module>
    main(sys.argv)
  File "bin/osh", line 417, in main
    sys.exit(OilMain(argv))
  File "bin/osh", line 400, in OilMain
    status = OshMain(main_argv)
  File "bin/osh", line 359, in OshMain
    status = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 1212, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 1057, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 962, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 1024, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 1004, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 957, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 853, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 811, in _EvalWordPart
    num = arith_ev.Eval(part.anode)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 129, in Eval
    return self._Eval(node)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 234, in _Eval
    raise AssertionError("Shouldn't get here")
AssertionError: Shouldn't get here
dash16 Comma operator (borrowed from C)

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

[osh stdout] Expected u'5\n5\n', got ''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 430, in <module>
    main(sys.argv)
  File "bin/osh", line 417, in main
    sys.exit(OilMain(argv))
  File "bin/osh", line 400, in OilMain
    status = OshMain(main_argv)
  File "bin/osh", line 359, in OshMain
    status = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 1212, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 1057, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 962, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 1024, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 1004, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 957, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 853, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 811, in _EvalWordPart
    num = arith_ev.Eval(part.anode)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 129, in Eval
    return self._Eval(node)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 232, in _Eval
    raise NotImplementedError("Unhandled node %r" % node.__class__.__name__)
NotImplementedError: Unhandled node 'ArithAssign'
osh18 Bitwise ops

[osh stdout] Expected u'3\n0\n-4\n', got ''

stdout:
stderr: 
Traceback (most recent call last):
  File "bin/osh", line 430, in <module>
    main(sys.argv)
  File "bin/osh", line 417, in main
    sys.exit(OilMain(argv))
  File "bin/osh", line 400, in OilMain
    status = OshMain(main_argv)
  File "bin/osh", line 359, in OshMain
    status = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 1212, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 1057, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 962, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 1024, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 1004, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 957, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 853, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 811, in _EvalWordPart
    num = arith_ev.Eval(part.anode)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 129, in Eval
    return self._Eval(node)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 234, in _Eval
    raise AssertionError("Shouldn't get here")
AssertionError: Shouldn't get here
dash20 No floating point

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

stdout:
3.2999999999999998
stderr:
osh20 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>'
  <no position info for token>
Error reading arith word in ArithParser
---
Line 0 of '<unknown>'
  <no position info for token>

---
Line 0 of '<unknown>'
  <no position info for token>
Error parsing arith sub part
---
Line 1 of '<stdin>'
  echo $((1 + 2.3))
               ^
Error reading command word
---
Line 0 of '<unknown>'
  <no position info for token>
Error parsing AndOr in ParseCommandTerm
---
dash21 Array indexing in arith

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

stdout:
7
stderr:
osh21 Array indexing in arith

[osh stdout] Expected '11\n', got ''

stdout:
stderr: 
osh warning: Expected string but got (StrArray strs:["'1'""'2'""'3'""'4'"])
Traceback (most recent call last):
  File "bin/osh", line 430, in <module>
    main(sys.argv)
  File "bin/osh", line 417, in main
    sys.exit(OilMain(argv))
  File "bin/osh", line 400, in OilMain
    status = OshMain(main_argv)
  File "bin/osh", line 359, in OshMain
    status = ex.Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 1212, in Execute
    status = self._Execute(node)
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 1057, in _Execute
    status = self._Execute(child)  # last status wins
  File "/home/andy/git/oil/bin/../core/cmd_exec.py", line 962, in _Execute
    argv = self.ev.EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 1024, in EvalWordSequence
    return self._EvalWordSequence(words)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 1004, in _EvalWordSequence
    args = self._EvalWordAndReframe(w)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 957, in _EvalWordAndReframe
    part_vals = self._EvalParts(word)
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 853, in _EvalParts
    for v in self.part_ev._EvalWordPart(p, quoted=quoted):
  File "/home/andy/git/oil/bin/../core/word_eval.py", line 811, in _EvalWordPart
    num = arith_ev.Eval(part.anode)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 129, in Eval
    return self._Eval(node)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 201, in _Eval
    lhs = self._Eval(node.left)
  File "/home/andy/git/oil/bin/../core/expr_eval.py", line 234, in _Eval
    raise AssertionError("Shouldn't get here")
AssertionError: Shouldn't get here
dash22 Constants in base 36

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

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

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

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

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

stdout:
11
stderr:
zsh25 Octal constant

stdout:
11
stderr:
mksh26 Dynamic octal constant

stdout:
11
stderr:
zsh26 Dynamic octal constant

stdout:
11
stderr:
osh28 Dynamic var names!

[osh stdout] Expected '11\n', got '6\n'

stdout:
6
stderr:
osh warning: Invalid integer constant 'foo'
dash29 nounset with arithmetic

stdout:
should not get here: x=5
stderr:
mksh29 nounset with arithmetic

stdout:
should not get here: x=5
stderr:
zsh29 nounset with arithmetic

stdout:
should not get here: x=5
stderr: