summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-06-29 18:37:53 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-06-29 18:37:53 +0200
commit5d6c2f89de31187b0b3f1e165037b7dea4dad133 (patch)
tree3055b71850dc06a1589baf68ef3c5a7e9636b688 /tests
parentd66a92044701fbf4246625a1be31cbcaed944bdb (diff)
downloadNim-5d6c2f89de31187b0b3f1e165037b7dea4dad133.tar.gz
fixes #4703
Diffstat (limited to 'tests')
-rw-r--r--tests/js/tcopying.nim24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/js/tcopying.nim b/tests/js/tcopying.nim
index 4f72d6ada..387df9cd3 100644
--- a/tests/js/tcopying.nim
+++ b/tests/js/tcopying.nim
@@ -1,5 +1,7 @@
 discard """
   output: '''123
+2 9
+2 9
 '''
 """
 
@@ -11,3 +13,25 @@ proc changeArray(a: var MyArray) =
 var a : MyArray
 changeArray(a)
 echo a[0]
+
+# bug #4703
+# Test 1
+block:
+    let ary1 = [1, 2, 3]
+    var ary2 = ary1
+
+    ary2[1] = 9
+
+    echo ary1[1], " ", ary2[1]
+
+# Test 2
+block:
+    type TestObj = ref object of RootObj
+        ary2: array[3, int]
+
+    let ary1 = [1, 2, 3]
+    var obj = TestObj(ary2:ary1)
+
+    obj.ary2[1] = 9
+
+    echo ary1[1], " ", obj.ary2[1]