OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Based on: https://hg.mozilla.org/mozilla-central/file/d0c3168c3c47/js/src/jit
-test/tests/collections/Array-of-1.js |
| 6 |
| 7 // Flags: --harmony-arrays |
| 8 |
| 9 |
| 10 // Array.of makes real arrays. |
| 11 |
| 12 function check(a) { |
| 13 assertEquals(Object.getPrototypeOf(a), Array.prototype); |
| 14 assertEquals(Array.isArray(a), true); |
| 15 a[9] = 9; |
| 16 assertEquals(a.length, 10); |
| 17 } |
| 18 |
| 19 |
| 20 check(Array.of()); |
| 21 check(Array.of(0)); |
| 22 check(Array.of(0, 1, 2)); |
| 23 var f = Array.of; |
| 24 check(f()); |
OLD | NEW |