Index: test/mjsunit/harmony/array-find.js |
diff --git a/test/mjsunit/harmony/array-find.js b/test/mjsunit/harmony/array-find.js |
index eb3208227706e6e3654549dac10d47b8197728dd..44fc78292a81123a9535999717c1085159af9874 100644 |
--- a/test/mjsunit/harmony/array-find.js |
+++ b/test/mjsunit/harmony/array-find.js |
@@ -201,7 +201,7 @@ assertEquals(22, a.find(function(val) { return 22 === val; }), undefined); |
// |
-// Test predicate is only called for existing elements |
+// Test predicate is called for holes |
// |
(function() { |
var a = new Array(30); |
@@ -211,7 +211,27 @@ assertEquals(22, a.find(function(val) { return 22 === val; }), undefined); |
var count = 0; |
a.find(function() { count++; return false; }); |
- assertEquals(3, count); |
+ assertEquals(30, count); |
+})(); |
+ |
+ |
+(function() { |
+ var a = [0, 1, , 3]; |
+ var count = 0; |
+ var found = a.find(function(val) { return val === undefined; }); |
+ assertEquals(undefined, found); |
+})(); |
+ |
+ |
+(function() { |
+ var a = [0, 1, , 3]; |
+ a.__proto__ = { |
+ __proto__: Array.prototype, |
+ 2: 42, |
+ }; |
+ var count = 0; |
+ var found = a.find(function(val) { return val === 42; }); |
+ assertEquals(42, found); |
})(); |