Index: test/mjsunit/string-index.js |
diff --git a/test/mjsunit/string-index.js b/test/mjsunit/string-index.js |
index 866faa89586f41a0321e6f0c63ae2aa92b65392d..1d6476ea19373bf518f3ae3859d1db104adc66ed 100644 |
--- a/test/mjsunit/string-index.js |
+++ b/test/mjsunit/string-index.js |
@@ -207,6 +207,28 @@ for (var i = 0; i < 100; ++i) { |
assertEquals(expected, actual); |
} |
+// Test negative zero case. |
+var keys = [0, -0.0]; |
+var str = 'ab', arr = ['a', 'a']; |
+for (var i = 0; i < 100; ++i) { |
+ var index = Math.floor(i / 50); |
+ var key = keys[index]; |
+ var expected = arr[index]; |
+ var actual = str[key]; |
+ assertEquals(expected, actual); |
+} |
+ |
+// Test "not-an-array-index" case. |
+var keys = [0, 0.5]; |
+var str = 'ab', arr = ['a', undefined]; |
+for (var i = 0; i < 100; ++i) { |
+ var index = Math.floor(i / 50); |
+ var key = keys[index]; |
+ var expected = arr[index]; |
+ var actual = str[key]; |
+ assertEquals(expected, actual); |
+} |
+ |
// Test out of range case. |
var keys = [0, -1]; |
var str = 'ab', arr = ['a', undefined]; |
@@ -234,4 +256,4 @@ for (var i = 0; i < 50; ++i) { |
var expected = arr[0]; |
var actual = str[0]; |
assertEquals(expected, actual); |
-} |
+} |