| Index: test/mjsunit/harmony/array-find.js
|
| diff --git a/test/mjsunit/harmony/array-find.js b/test/mjsunit/harmony/array-find.js
|
| index 9f5750eca05d03a66c979902b021c1564672b893..70f41f612a4fb2c0d2cb986acd8f48b908d823e8 100644
|
| --- a/test/mjsunit/harmony/array-find.js
|
| +++ b/test/mjsunit/harmony/array-find.js
|
| @@ -237,6 +237,24 @@ assertEquals(22, a.find(function(val) { return 22 === val; }), undefined);
|
| return this.elementAt(key) === val;
|
| }, thisArg);
|
| assertEquals("b", found);
|
| +
|
| + // When evaluating 'this', primitive values should be coerced to an object.
|
| + // See ECMA-262, Annex C.
|
| + a = [];
|
| + [1, 2].find(function() { a.push(this) }, "");
|
| + assertTrue(a[0] !== a[1]);
|
| +
|
| + // When evaluating 'this', non-primitive values are not coerced to an object.
|
| + a = [];
|
| + [1, 2].find(function() { a.push(this) }, {});
|
| + assertFalse(a[0] !== a[1]);
|
| +
|
| + // In strict mode, when evaluating 'this', primitive values should not be
|
| + // coerced to an object.
|
| + a = [];
|
| + [1, 2].find(function() { 'use strict'; a.push(this); }, "");
|
| + assertTrue(a[0] === "" && a[0] === a[1]);
|
| +
|
| })();
|
|
|
| // Test exceptions
|
|
|