Files
coffeescript/test/exponentiation.coffee
Geoffrey Booth 195a46ab77 Fix #4877: Exponentiation operators (#4881)
* Passthrough exponentiation operator; remove tests that are invalid JavaScript

* Treat **= as a passthrough assignment

* Get tests passing in Node 6

* Improve scoping

* Move exponentiation tests into their own file, now that it's filtered out by Cakefile

* Restore original test
2018-03-30 00:47:40 -07:00

20 lines
548 B
CoffeeScript

# The `**` and `**=` operators are only supported in Node 7.5+, so the tests
# for these exponentiation operators are split out into their own file to be
# loaded only by supported runtimes.
test "exponentiation operator", ->
eq 27, 3 ** 3
test "exponentiation operator has higher precedence than other maths operators", ->
eq 55, 1 + 3 ** 3 * 2
eq -4, -2 ** 2
eq 0, (!2) ** 2
test "exponentiation operator is right associative", ->
eq 2, 2 ** 1 ** 3
test "exponentiation operator compound assignment", ->
a = 2
a **= 3
eq 8, a