summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorParashurama <Rhagdamaziel@ymail.com>2017-08-10 21:01:13 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-08-19 08:58:57 +0200
commitf64eee3a1ebf1cda39160551d0070eada6ed34c9 (patch)
treec0e3a5062efdbfde8f35a9d8151e00a6734e7942
parent03b11b66cfeed51d56fe45de4d2a761755dba407 (diff)
downloadNim-f64eee3a1ebf1cda39160551d0070eada6ed34c9.tar.gz
add testcase for mitems returning tuple on VM.
-rw-r--r--tests/vm/tmitems.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/vm/tmitems.nim b/tests/vm/tmitems.nim
index a77c3fb23..a0e64d6aa 100644
--- a/tests/vm/tmitems.nim
+++ b/tests/vm/tmitems.nim
@@ -29,3 +29,17 @@ macro m: typed =
     result.add newCall(bindsym"echo", i)
 
 m()
+
+# bug 4741 & 5013
+proc test() =
+  var s = [("baz", 42), ("bath", 42)]
+  for i in s.mitems:
+    i[1] = 3
+  doAssert(s == [("baz", 3), ("bath", 3)])
+
+static:
+  test()
+  var s = [("baz", 42), ("bath", 42)]
+  for i in s.mitems:
+    i[1] = 3
+  doAssert(s == [("baz", 3), ("bath", 3)])