Index: test/mjsunit/harmony/typedarrays.js |
diff --git a/test/mjsunit/harmony/typedarrays.js b/test/mjsunit/harmony/typedarrays.js |
index 5b75874cd40685897393613ab693a521318eb828..af5672966dd649ce9a807405ea2abb42eff9d925 100644 |
--- a/test/mjsunit/harmony/typedarrays.js |
+++ b/test/mjsunit/harmony/typedarrays.js |
@@ -481,6 +481,36 @@ function TestTypedArraySet() { |
TestTypedArraySet(); |
+function TestTypedArraysWithIllegalIndices() { |
+ var a = new Int32Array(100); |
+ |
+ a[-10] = 10; |
+ assertEquals(undefined, a[-10]); |
+ a["-10"] = 10; |
+ assertEquals(undefined, a["-10"]); |
+ |
+ var s = " -10"; |
+ a[s] = 10; |
+ assertEquals(10, a[s]); |
+ var s1 = " -10 "; |
+ a[s] = 10; |
+ assertEquals(10, a[s]); |
+ |
+ a["-1e2"] = 10; |
+ assertEquals(10, a["-1e2"]); |
+ assertEquals(undefined, a[-1e2]); |
+ |
+ a[-Infinity] = 50; |
+ assertEquals(undefined, a[-Infinity]); |
+ a[1.5] = 10; |
+ assertEquals(undefined, a[1.5]); |
+ var nan = Math.sqrt(-1); |
+ a[nan] = 5; |
+ assertEquals(5, a[nan]); |
+} |
+ |
+TestTypedArraysWithIllegalIndices(); |
+ |
// DataView |
function TestDataViewConstructor() { |
var ab = new ArrayBuffer(256); |