diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2020-11-27 03:30:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-26 20:30:19 +0100 |
commit | 70a1c4254230eb8f3c4d24ccbc253c0a28065d03 (patch) | |
tree | 0fbdb389d1def3f7f5a71b342e72414f20e6988f /tests | |
parent | 4fdaded227070c651c4eb6a2517041a195617e64 (diff) | |
download | Nim-70a1c4254230eb8f3c4d24ccbc253c0a28065d03.tar.gz |
add `**` to jsffi (#16141)
* fix rope index * add testcase * fix ropes format * add `**` to jsffi * add testcase * changelog Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/js/tjsffi.nim | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/js/tjsffi.nim b/tests/js/tjsffi.nim index af33cee8a..143ac4a25 100644 --- a/tests/js/tjsffi.nim +++ b/tests/js/tjsffi.nim @@ -323,7 +323,6 @@ block: console.log jsarguments[0] block: - echo jsUndefined == jsNull echo jsUndefined == nil echo jsNull == nil @@ -331,3 +330,36 @@ block: echo jsNull.isNil echo jsNull.isNull echo jsUndefined.isUndefined + +block: # test ** + var a = toJs(0) + var b = toJs(0) + doAssert to(a ** b, int) == 1 + a = toJs(1) + b = toJs(1) + doAssert to(a ** b, int) == 1 + a = toJs(-1) + b = toJs(-1) + doAssert to(a ** b, int) == -1 + a = toJs(6) + b = toJs(6) + doAssert to(a ** b, int) == 46656 + a = toJs(5.5) + b = toJs(3) + doAssert to(a ** b, float) == 166.375 + a = toJs(5) + b = toJs(3.0) + doAssert to(a ** b, float) == 125.0 + a = toJs(7.0) + b = toJS(6.0) + doAssert to(a ** b, float) == 117649.0 + a = toJs(8) + b = toJS(-2) + doAssert to(a ** b, float) == 0.015625 + + a = toJs(1) + b = toJs(1) + doAssert to(`**`(a + a, b), int) == 2 + + doAssert to(`**`(toJs(1) + toJs(1), toJs(2)), int) == 4 + |