Index: test/mjsunit/harmony/typedarray-findindex.js |
diff --git a/test/mjsunit/harmony/typedarray-findindex.js b/test/mjsunit/harmony/typedarray-findindex.js |
index 5a0afb4e0b9082a904f449632609cbd4ad157531..1634448711d315b998998209329178fa0ad27283 100644 |
--- a/test/mjsunit/harmony/typedarray-findindex.js |
+++ b/test/mjsunit/harmony/typedarray-findindex.js |
@@ -176,4 +176,14 @@ assertThrows('new constructor([]).findIndex({})', TypeError); |
assertThrows('new constructor([]).findIndex([])', TypeError); |
assertThrows('new constructor([]).findIndex(/\d+/)', TypeError); |
+// Shadowing length doesn't affect findIndex, unlike Array.prototype.findIndex |
+a = new constructor([1, 2]); |
+Object.defineProperty(a, 'length', {value: 1}); |
+var x = 0; |
+assertEquals(a.findIndex(function(elt) { x += elt; return false; }), -1); |
+assertEquals(x, 3); |
+assertEquals(Array.prototype.findIndex.call(a, |
+ function(elt) { x += elt; return false; }), -1); |
+assertEquals(x, 4); |
+ |
} |