summary refs log tree commit diff stats
path: root/tests/js/t9410.nim
diff options
context:
space:
mode:
authorDean Thompson <deansherthompson@gmail.com>2019-01-21 16:40:04 -0500
committerGitHub <noreply@github.com>2019-01-21 16:40:04 -0500
commita6de0274ee768d135bab280d2b2700a0bb475300 (patch)
tree176b91e837ab7d2217713665c16fc28163017960 /tests/js/t9410.nim
parent5b39c7aca91c1d20eb81425cf8f3854876aed475 (diff)
parentee89ba6bdb664fe4972f2917499cff1afdac0bab (diff)
downloadNim-a6de0274ee768d135bab280d2b2700a0bb475300.tar.gz
Merge pull request #1 from nim-lang/devel
Getting the latest from nim-lang
Diffstat (limited to 'tests/js/t9410.nim')
-rw-r--r--tests/js/t9410.nim37
1 files changed, 27 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