arith () { run-file arith "$@" } 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
250 passed, 28 OK, 51 not implemented, 21 BUG, 0 failed, 0 timeouts, 0 cases skipped
| dash | 0 Side Effect in Array Indexing stdout: stderr: dash: 1: Syntax error: "(" unexpected
 | 
| zsh | 0 Side Effect in Array Indexing stdout: 5 b=2stderr:  | 
| bash | 7 Constant with quotes like '1' stdout: stderr: bash: line 1: '1' + 2: syntax error: operand expected (error token is "'1' + 2")  | 
| dash | 7 Constant with quotes like '1' stdout: stderr: dash: 1: arithmetic expression: expecting primary: "'1' + 2"  | 
| zsh | 7 Constant with quotes like '1' stdout: stderr: zsh: bad math expression: illegal character: '  | 
| bash | 10 Invalid string to int stdout: 5stderr: bash: line 1: shopt: strict_arith: invalid shell option name  | 
| dash | 10 Invalid string to int stdout: stderr: dash: 1: shopt: not found dash: 3: Illegal number: foo  | 
| mksh | 10 Invalid string to int stdout: 5stderr: mksh: <stdin>[1]: shopt: not found  | 
| zsh | 10 Invalid string to int stdout: 5stderr: zsh: command not found: shopt  | 
| osh | 10 Invalid string to int stdout: 5stderr:  | 
| bash | 11 Invalid string to int with strict_arith stdout: foo 5 should not get herestderr: bash: line 1: shopt: strict_arith: invalid shell option name  | 
| dash | 11 Invalid string to int with strict_arith stdout: foostderr: dash: 1: shopt: not found dash: 4: Illegal number: foo  | 
| mksh | 11 Invalid string to int with strict_arith stdout: foo 5 should not get herestderr: mksh: <stdin>[1]: shopt: not found  | 
| zsh | 11 Invalid string to int with strict_arith stdout: foo 5 should not get herestderr: zsh: command not found: shopt  | 
| dash | 14 Preincrement stdout: 4 4stderr:  | 
| dash | 15 Postincrement stdout: stderr: dash: 2: arithmetic expression: expecting primary: "a++"  | 
| dash | 16 Increment undefined variables stdout: [][]stderr: dash: 1: shopt: not found dash: 2: undef1++: not found dash: 3: ++undef2: not found  | 
| dash | 17 Increment and decrement array elements stdout: stderr: dash: 1: shopt: not found
dash: 2: Syntax error: "(" unexpected
 | 
| zsh | 17 Increment and decrement array elements stdout: 5 6 7 8 -stderr: zsh: command not found: shopt zsh: a: assignment to invalid subscript range zsh: undef: assignment to invalid subscript range  | 
| dash | 18 Increment undefined variables with nounset stdout: stderr: dash: 2: undef1++: not found dash: 3: ++undef2: not found dash: 4: undef1: parameter not set  | 
| mksh | 18 Increment undefined variables with nounset stdout: [1][1]stderr:  | 
| zsh | 18 Increment undefined variables with nounset stdout: [1][1]stderr:  | 
| dash | 19 Comma operator (borrowed from C) stdout: stderr: dash: 3: arithmetic expression: expecting EOF: "a,(b+1)"  | 
| dash | 23 Logical Ops Short Circuit stdout: 11 11 11 11stderr: dash: 2: 1: not found dash: 2: x: not found dash: 4: 0: not found dash: 4: x: not found dash: 6: 0: not found dash: 8: 1: not found  | 
| bash | 26 No floating point stdout: stderr: bash: line 1: 1 + 2.3: syntax error: invalid arithmetic operator (error token is ".3")  | 
| mksh | 26 No floating point stdout: stderr: mksh: <stdin>[1]: 1 + 2.3: unexpected '.'  | 
| zsh | 26 No floating point stdout: 3.2999999999999998stderr:  | 
| dash | 27 Array indexing in arith stdout: stderr: dash: 1: Syntax error: "(" unexpected
 | 
| zsh | 27 Array indexing in arith stdout: 7stderr:  | 
| dash | 28 Constants in base 36 stdout: stderr: dash: 1: arithmetic expression: expecting EOF: "36#a"  | 
| dash | 29 Constants in bases 2 to 64 stdout: stderr: dash: 1: arithmetic expression: expecting EOF: "64#a"  | 
| mksh | 29 Constants in bases 2 to 64 stdout: stderr: mksh: <stdin>[1]: 64#a: bad number '64#a'  | 
| zsh | 29 Constants in bases 2 to 64 stdout: stderr: zsh: invalid base (must be 2 to 36 inclusive): 64  | 
| dash | 30 Multiple digit constants with base N stdout: stderr: dash: 1: arithmetic expression: expecting EOF: "10#0123"  | 
| dash | 31 Dynamic base constants stdout: stderr: dash: 2: arithmetic expression: expecting EOF: " 16#a "  | 
| mksh | 32 Octal constant stdout: 11stderr:  | 
| zsh | 32 Octal constant stdout: 11stderr:  | 
| mksh | 33 Dynamic octal constant stdout: 11stderr:  | 
| zsh | 33 Dynamic octal constant stdout: 11stderr:  | 
| dash | 36 Recursive name evaluation is a result of runtime parse/eval stdout: stderr: dash: 5: Illegal number: foo  | 
| dash | 37 nounset with arithmetic stdout: should not get here: x=5stderr:  | 
| mksh | 37 nounset with arithmetic stdout: should not get here: x=5stderr:  | 
| zsh | 37 nounset with arithmetic stdout: should not get here: x=5stderr:  | 
| mksh | 38 64-bit integer doesn't overflow stdout: -2147483648 0 -2147483648 max positive = 2147483647stderr:  | 
| dash | 39 More 64-bit ops stdout: stderr:  | 
| mksh | 39 More 64-bit ops stdout: eq=1 eq=0 greater=1 greater=1 ge=1 ge=0 le=0 le=0stderr:  | 
| bash | 40 Invalid LValue stdout: 9stderr: bash: line 2: ((: (a + 2) = 3 : attempted assignment to non-variable (error token is "= 3 ")  | 
| dash | 40 Invalid LValue stdout: stderr: dash: 2: Syntax error: word unexpected (expecting ")")  | 
| mksh | 40 Invalid LValue stdout: 9stderr: mksh: <stdin>[2]: (a + 2) = 3 : = requires lvalue  | 
| zsh | 40 Invalid LValue stdout: 9stderr: zsh: bad math expression: lvalue required  | 
| bash | 41 Invalid LValue that looks like array stdout: status=1stderr: bash: line 1: ((: 1[2] = 3 : syntax error: invalid arithmetic operator (error token is "[2] = 3 ")  | 
| dash | 41 Invalid LValue that looks like array stdout: status=127stderr: dash: 1: 1[2]: not found  | 
| mksh | 41 Invalid LValue that looks like array stdout: status=2stderr: mksh: <stdin>[1]: 1[2] = 3 : unexpected '['  | 
| zsh | 41 Invalid LValue that looks like array stdout: status=2stderr: zsh: bad base syntax  | 
| bash | 42 Invalid LValue: two sets of brackets stdout: status=1stderr: bash: line 1: ((: a[1][2] = 3 : syntax error: invalid arithmetic operator (error token is "[2] = 3 ")  | 
| dash | 42 Invalid LValue: two sets of brackets stdout: status=127stderr: dash: 1: a[1][2]: not found  | 
| mksh | 42 Invalid LValue: two sets of brackets stdout: status=2stderr: mksh: <stdin>[1]: a[1][2] = 3 : unexpected '['  | 
| zsh | 42 Invalid LValue: two sets of brackets stdout: status=2stderr: zsh: bad base syntax  | 
| dash | 44 Exponentiation with ** stdout: stderr: dash: 1: arithmetic expression: expecting primary: " 3 ** 0 "  | 
| mksh | 44 Exponentiation with ** stdout: stderr: mksh: <stdin>[1]: 3 ** 0 : unexpected '*'  | 
| dash | 45 Exponentiation operator has buggy precedence stdout: stderr: dash: 1: arithmetic expression: expecting primary: " -3 ** 2 "  | 
| mksh | 45 Exponentiation operator has buggy precedence stdout: stderr: mksh: <stdin>[1]: -3 ** 2 : unexpected '*'  | 
| dash | 46 Negative exponent stdout: stderr: dash: 1: arithmetic expression: expecting primary: " 2**-1 * 5 "  | 
| zsh | 46 Negative exponent stdout: 2.5stderr:  | 
| bash | 47 Comment not allowed in the middle of multiline arithmetic stdout: 6 []stderr: bash: line 8: 1 + 2 # not a comment : syntax error: invalid arithmetic operator (error token is "# not a comment ") bash: line 10: ((: a = 3 + 4 # comment : syntax error: invalid arithmetic operator (error token is "# comment ")  | 
| dash | 47 Comment not allowed in the middle of multiline arithmetic stdout: 6stderr: dash: 6: arithmetic expression: expecting EOF: " 1 + 2 # not a comment "  | 
| osh | 47 Comment not allowed in the middle of multiline arithmetic stdout: 6stderr:   1 + 2  # not a comment
         ^
[ stdin ]:7: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen)
 | 
| dash | 48 Add integer to indexed array (a[0] decay) stdout: stderr: dash: 1: Syntax error: "(" unexpected
 | 
| mksh | 48 Add integer to indexed array (a[0] decay) stdout: stderr: mksh: <stdin>[1]: syntax error: '(' unexpected
 | 
| zsh | 48 Add integer to indexed array (a[0] decay) stdout: stderr: zsh: bad math expression: operator expected at `2 3'  | 
| dash | 49 Add integer to associative array (a[0] decay) stdout: 5stderr: dash: 1: typeset: not found dash: 2: assoc[0]=42: not found  | 
| dash | 50 Double subscript stdout: stderr: dash: 1: Syntax error: "(" unexpected
 | 
| zsh | 50 Double subscript stdout: 1stderr: zsh: bad base syntax  | 
| osh | 50 Double subscript stdout: 2stderr:   echo $(( a[1][1] ))
               ^
[ stdin ]:3: The [ operator doesn't apply to this expression
 | 
| dash | 51 result of ArithSub -- array[0] decay stdout: stderr: dash: 1: Syntax error: "(" unexpected
 | 
| zsh | 51 result of ArithSub -- array[0] decay stdout: declaredstderr: zsh: bad math expression: operator expected at `5 6'  | 
| dash | 52 result of ArithSub -- assoc[0] decay stdout: stderr: dash: 1: Syntax error: "(" unexpected
 | 
| mksh | 52 result of ArithSub -- assoc[0] decay stdout: stderr: mksh: <stdin>[1]: syntax error: '(' unexpected
 | 
| dash | 53 comma operator stdout: stderr: dash: 1: Syntax error: "(" unexpected
 | 
| zsh | 53 comma operator stdout: stderr: zsh: bad math expression: operator expected at `5 6'  | 
| dash | 55 array assignment with dynamic array name stdout: stderr: dash: 2: arithmetic expression: expecting EOF: " xbar[5] = 42 "  | 
| zsh | 55 array assignment with dynamic array name stdout: 42 xbar[5]=stderr:  | 
| dash | 56 unary assignment with dynamic var name stdout: stderr: dash: 3: arithmetic expression: expecting primary: " xbar++ "  | 
| dash | 57 unary array assignment with dynamic var name stdout: stderr: dash: 2: xbar[5]=42: not found dash: 3: arithmetic expression: expecting EOF: " xbar[5]++ "  | 
| zsh | 57 unary array assignment with dynamic var name stdout: 0 xbar[5]=42stderr:  | 
| dash | 58 Dynamic parsing of arithmetic stdout: stderr: dash: 2: Illegal number: 1+2  | 
| mksh | 58 Dynamic parsing of arithmetic stdout: 6 true status=0stderr:  | 
| zsh | 61 1 ? a=1 : b=2 ( bug fix) stdout: stderr: zsh: bad math expression: ':' expected  | 
| bash | 62 Invalid constant stdout: 0 status=0 status=1 status=1stderr: bash: line 1: a + 42x: value too great for base (error token is "42x") bash: line 7: a + 42x: value too great for base (error token is "42x")  | 
| dash | 62 Invalid constant stdout: 0 status=0 status=2stderr: dash: 1: arithmetic expression: expecting EOF: "a + 42x" dash: 7: arithmetic expression: expecting EOF: "a + 42x"  | 
| dash | 65 undef[0] stdout: stderr:  | 
| dash | 66 undef[0] with nounset stdout: stderr:  | 
| mksh | 66 undef[0] with nounset stdout: UNSET 0 status=0stderr:  | 
| zsh | 66 undef[0] with nounset stdout: UNSET 0 status=0stderr:  | 
| dash | 67 s[0] with string abc stdout: stderr:  | 
| dash | 68 s[0] with string 42 stdout: stderr:  | 
| zsh | 68 s[0] with string 42 stdout: 42 0 4 status=0stderr:  | 
| bash | 69 s[0] with string '12 34' stdout: status=1stderr: bash: line 2: 12 34: syntax error in expression (error token is "34")  | 
| dash | 69 s[0] with string '12 34' stdout: stderr: dash: 2: Illegal number: 12 34  | 
| zsh | 69 s[0] with string '12 34' stdout: 12 34 0 1 status=0stderr:  |