| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --harmony-array-includes | |
| 6 | |
| 7 // Largely ported from | 5 // Largely ported from |
| 8 // https://github.com/tc39/Array.prototype.includes/tree/master/test | 6 // https://github.com/tc39/Array.prototype.includes/tree/master/test |
| 9 // using https://www.npmjs.org/package/test262-to-mjsunit with further edits | 7 // using https://www.npmjs.org/package/test262-to-mjsunit with further edits |
| 10 | 8 |
| 11 | 9 |
| 12 // Array.prototype.includes sees a new element added by a getter that is hit | 10 // Array.prototype.includes sees a new element added by a getter that is hit |
| 13 // during iteration | 11 // during iteration |
| 14 (function() { | 12 (function() { |
| 15 var arrayLike = { | 13 var arrayLike = { |
| 16 length: 5, | 14 length: 5, |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 (function() { | 666 (function() { |
| 669 assertTrue(Array.prototype.includes.call(new Uint8Array([1, 2, 3]), 2)); | 667 assertTrue(Array.prototype.includes.call(new Uint8Array([1, 2, 3]), 2)); |
| 670 | 668 |
| 671 assertTrue( | 669 assertTrue( |
| 672 Array.prototype.includes.call(new Float32Array([2.5, 3.14, Math.PI]), 3.1415
927410125732) | 670 Array.prototype.includes.call(new Float32Array([2.5, 3.14, Math.PI]), 3.1415
927410125732) |
| 673 ); | 671 ); |
| 674 | 672 |
| 675 assertFalse(Array.prototype.includes.call(new Uint8Array([1, 2, 3]), 4)); | 673 assertFalse(Array.prototype.includes.call(new Uint8Array([1, 2, 3]), 4)); |
| 676 assertFalse(Array.prototype.includes.call(new Uint8Array([1, 2, 3]), 2, 2)); | 674 assertFalse(Array.prototype.includes.call(new Uint8Array([1, 2, 3]), 2, 2)); |
| 677 })(); | 675 })(); |
| OLD | NEW |