OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 (function testSmiArrayConcat() { |
| 6 var result = [].concat([-12]); |
| 7 |
| 8 assertEquals(1, result.length); |
| 9 assertEquals([-12], result); |
| 10 })(); |
| 11 |
| 12 (function testDoubleArrayConcat() { |
| 13 var result = [].concat([-1073741825]); |
| 14 |
| 15 assertEquals(1, result.length); |
| 16 assertEquals([-1073741825], result); |
| 17 })(); |
| 18 |
| 19 (function testSmiArrayNonConcatSpreadable() { |
| 20 var array = [-10]; |
| 21 array[Symbol.isConcatSpreadable] = false; |
| 22 var result = [].concat(array); |
| 23 |
| 24 assertEquals(1, result.length); |
| 25 assertEquals(1, result[0].length); |
| 26 assertEquals([-10], result[0]); |
| 27 })(); |
| 28 |
| 29 (function testDoubleArrayNonConcatSpreadable() { |
| 30 var array = [-1073741825]; |
| 31 array[Symbol.isConcatSpreadable] = false; |
| 32 var result = [].concat(array); |
| 33 |
| 34 assertEquals(1, result.length); |
| 35 assertEquals(1, result[0].length); |
| 36 assertEquals([-1073741825], result[0]); |
| 37 })(); |
| 38 |
| 39 Array.prototype[Symbol.isConcatSpreadable] = false; |
| 40 |
| 41 |
| 42 (function testSmiArray() { |
| 43 var result = [].concat([-12]); |
| 44 |
| 45 assertEquals(2, result.length); |
| 46 assertEquals(0, result[0].length); |
| 47 assertEquals(1, result[1].length); |
| 48 assertEquals([-12], result[1]); |
| 49 })(); |
| 50 |
| 51 (function testDoubleArray() { |
| 52 var result = [].concat([-1073741825]); |
| 53 |
| 54 assertEquals(2, result.length); |
| 55 assertEquals(0, result[0].length); |
| 56 assertEquals(1, result[1].length); |
| 57 assertEquals([-1073741825], result[1]); |
| 58 })(); |
OLD | NEW |