summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorhlaaftana <10591326+hlaaftana@users.noreply.github.com>2020-04-29 09:59:08 +0300
committerGitHub <noreply@github.com>2020-04-29 08:59:08 +0200
commit800ce5b9507469d1d8e87d4e7730e2f1750dc8d7 (patch)
tree85c8073b4bcd01ef17056b6fae76d02846058005 /tests
parent3b5a504692495324afdb7c20159122e66100f767 (diff)
downloadNim-800ce5b9507469d1d8e87d4e7730e2f1750dc8d7.tar.gz
Fix negative indexed arrays for JS, refs #13966 (#14152)
* Fix negative arrays for JS, refs #13966

* small extra fix: no need to .slice() cstring in JS
Diffstat (limited to 'tests')
-rw-r--r--tests/js/tarrayboundscheck.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/js/tarrayboundscheck.nim b/tests/js/tarrayboundscheck.nim
index f0eaeb89d..d8bf8de97 100644
--- a/tests/js/tarrayboundscheck.nim
+++ b/tests/js/tarrayboundscheck.nim
@@ -39,6 +39,12 @@ proc test_arrayboundscheck() =
         echo "month out of bounds: ", idx
     except:
       echo "idx out of bounds: ", i
+  
+  # #13966
+  var negativeIndexed: array[-2..2, int] = [0, 1, 2, 3, 4]
+  negativeIndexed[-1] = 2
+  negativeIndexed[1] = 2
+  doAssert negativeIndexed == [0, 2, 2, 2, 4]
 
 test_arrayboundscheck()
 {.pop.}
\ No newline at end of file