| Index: test/mjsunit/harmony/array-findindex.js
|
| diff --git a/test/mjsunit/harmony/array-findindex.js b/test/mjsunit/harmony/array-findindex.js
|
| index a33849dab393afd1f233bd9ec5461d0c489e794a..c749591fdf5deafe7c9b7cf7f64da57103d02957 100644
|
| --- a/test/mjsunit/harmony/array-findindex.js
|
| +++ b/test/mjsunit/harmony/array-findindex.js
|
| @@ -237,6 +237,23 @@ assertEquals(3, a.findIndex(function(val) { return 24 === val; }));
|
| return this.elementAt(key) === val;
|
| }, thisArg);
|
| assertEquals(1, index);
|
| +
|
| + // Create a new object in each function call when receiver is a
|
| + // primitive value. See ECMA-262, Annex C.
|
| + a = [];
|
| + [1, 2].findIndex(function() { a.push(this) }, "");
|
| + assertTrue(a[0] !== a[1]);
|
| +
|
| + // Do not create a new object otherwise.
|
| + a = [];
|
| + [1, 2].findIndex(function() { a.push(this) }, {});
|
| + assertFalse(a[0] !== a[1]);
|
| +
|
| + // In strict mode primitive values should not be coerced to an object.
|
| + a = [];
|
| + [1, 2].findIndex(function() { 'use strict'; a.push(this); }, "");
|
| + assertTrue(a[0] === "" && a[0] === a[1]);
|
| +
|
| })();
|
|
|
| // Test exceptions
|
|
|