summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2022-06-11 02:33:44 +0800
committerGitHub <noreply@github.com>2022-06-10 20:33:44 +0200
commit1e5dd9022b0d86d63d616431a0f9959ca4c10f40 (patch)
tree98d291d307e191512edd2d087e37eb5d0aa853b2
parent8cde6ba6bcf236478f1d5d5aa722977ce9723a57 (diff)
downloadNim-1e5dd9022b0d86d63d616431a0f9959ca4c10f40.tar.gz
[js] add testcase for array indexDefect and remove todo (#19838)
* remove unused opcSubstr

* [js] add testcase for array indexDefect

* Revert "remove unused opcSubstr"

This reverts commit cb461f2545234d62c1e0b83318f3e5495c97de52.
-rw-r--r--lib/system/jssys.nim4
-rw-r--r--tests/js/tindexdefect.nim9
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/system/jssys.nim b/lib/system/jssys.nim
index 00a4a8ab6..a31de0d86 100644
--- a/lib/system/jssys.nim
+++ b/lib/system/jssys.nim
@@ -731,10 +731,6 @@ proc parseFloatNative(a: string): float =
   `result` = Number(`a2`);
   """
 
-#[
-xxx how come code like this doesn't give IndexDefect ?
-let z = s[10000] == 'a'
-]#
 proc nimParseBiggestFloat(s: string, number: var BiggestFloat, start: int): int {.compilerproc.} =
   var sign: bool
   var i = start
diff --git a/tests/js/tindexdefect.nim b/tests/js/tindexdefect.nim
new file mode 100644
index 000000000..37994ec2e
--- /dev/null
+++ b/tests/js/tindexdefect.nim
@@ -0,0 +1,9 @@
+discard """
+  outputsub: "unhandled exception: index 10000 not in 0 .. 0 [IndexDefect]"
+  exitcode: 1
+  joinable: false
+"""
+
+var s = ['a']
+let z = s[10000] == 'a'
+echo z
\ No newline at end of file