diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-02-08 17:18:17 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-02-08 17:18:17 +0100 |
commit | 0841c64a3217594d0d260a0f24616b469447c1b9 (patch) | |
tree | d16995b64b4cd42b7e3d9adf94dd7f7ff57b600c /tests/js | |
parent | cb9110c43d4ae9c29a0a1e0d54f7735712d4ba62 (diff) | |
parent | 444f2231c9b48c34f9bec2ce6cfa3de5ae2560b1 (diff) | |
download | Nim-0841c64a3217594d0d260a0f24616b469447c1b9.tar.gz |
Merge branch 'devel' into araq-quirky-exceptions
Diffstat (limited to 'tests/js')
-rw-r--r-- | tests/js/t9410.nim | 37 | ||||
-rw-r--r-- | tests/js/test2.nim | 3 |
2 files changed, 30 insertions, 10 deletions
diff --git a/tests/js/t9410.nim b/tests/js/t9410.nim index 9aca6d45b..78c329a24 100644 --- a/tests/js/t9410.nim +++ b/tests/js/t9410.nim @@ -1,13 +1,3 @@ -template doAssert(exp: untyped) = - when defined(echot9410): - let r = exp - echo $(instantiationInfo().line) & ":\n " & astToStr(exp) & "\n was " & repr(r) - when not defined(noassertt9410): - system.doAssert r - else: - when not defined(noassertt9410): - system.doAssert exp - template tests = block: var i = 0 @@ -428,6 +418,33 @@ template tests = let xptr2 = cast[type(xptr)](p2) doAssert xptr == xptr2 + + block: # var types + block t10202: + type Point = object + x: float + y: float + + var points: seq[Point] + + points.add(Point(x:1, y:2)) + + for i, p in points.mpairs: + p.x += 1 + + doAssert points[0].x == 2 + + block: + var ints = @[1, 2, 3] + for i, val in mpairs ints: + val *= 10 + doAssert ints == @[10, 20, 30] + + block: + var seqOfSeqs = @[@[1, 2], @[3, 4]] + for i, val in mpairs seqOfSeqs: + val[0] *= 10 + doAssert seqOfSeqs == @[@[10, 2], @[30, 4]] when false: block: # openarray diff --git a/tests/js/test2.nim b/tests/js/test2.nim index 0bfb99139..9ecdbb35c 100644 --- a/tests/js/test2.nim +++ b/tests/js/test2.nim @@ -9,6 +9,9 @@ js 3.14 # This file tests the JavaScript generator +doAssert getCurrentException() == nil +doAssert getCurrentExceptionMsg() == "" + # #335 proc foo() = var bar = "foo" |