OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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-arrays | |
6 | |
7 // Array's toString should call the object's own join method, if one exists and | 5 // Array's toString should call the object's own join method, if one exists and |
8 // is callable. Otherwise, just use the original Object.toString function. | 6 // is callable. Otherwise, just use the original Object.toString function. |
9 | 7 |
10 var typedArrayConstructors = [ | 8 var typedArrayConstructors = [ |
11 Uint8Array, | 9 Uint8Array, |
12 Int8Array, | 10 Int8Array, |
13 Uint16Array, | 11 Uint16Array, |
14 Int16Array, | 12 Int16Array, |
15 Uint32Array, | 13 Uint32Array, |
16 Int32Array, | 14 Int32Array, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Redefining length does not change result | 77 // Redefining length does not change result |
80 var a5 = new constructor([1, 2, 3]) | 78 var a5 = new constructor([1, 2, 3]) |
81 Object.defineProperty(a5, 'length', { value: 2 }); | 79 Object.defineProperty(a5, 'length', { value: 2 }); |
82 assertEquals("1,2,3", a5.join()); | 80 assertEquals("1,2,3", a5.join()); |
83 assertEquals("1,2,3", a5.toString()); | 81 assertEquals("1,2,3", a5.toString()); |
84 assertEquals("1,2,3", a5.toLocaleString()); | 82 assertEquals("1,2,3", a5.toLocaleString()); |
85 assertEquals("1,2", Array.prototype.join.call(a5)); | 83 assertEquals("1,2", Array.prototype.join.call(a5)); |
86 assertEquals("1,2,3", Array.prototype.toString.call(a5)); | 84 assertEquals("1,2,3", Array.prototype.toString.call(a5)); |
87 assertEquals("1,2", Array.prototype.toLocaleString.call(a5)); | 85 assertEquals("1,2", Array.prototype.toLocaleString.call(a5)); |
88 } | 86 } |
OLD | NEW |