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-strings | |
6 | |
7 // Tests taken from: | 5 // Tests taken from: |
8 // https://github.com/mathiasbynens/String.fromCodePoint | 6 // https://github.com/mathiasbynens/String.fromCodePoint |
9 | 7 |
10 assertEquals(String.fromCodePoint.length, 1); | 8 assertEquals(String.fromCodePoint.length, 1); |
11 assertEquals(String.propertyIsEnumerable("fromCodePoint"), false); | 9 assertEquals(String.propertyIsEnumerable("fromCodePoint"), false); |
12 | 10 |
13 assertEquals(String.fromCodePoint(""), "\0"); | 11 assertEquals(String.fromCodePoint(""), "\0"); |
14 assertEquals(String.fromCodePoint(), ""); | 12 assertEquals(String.fromCodePoint(), ""); |
15 assertEquals(String.fromCodePoint(-0), "\0"); | 13 assertEquals(String.fromCodePoint(-0), "\0"); |
16 assertEquals(String.fromCodePoint(0), "\0"); | 14 assertEquals(String.fromCodePoint(0), "\0"); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 result.push(0); // one code unit per symbol | 51 result.push(0); // one code unit per symbol |
54 } | 52 } |
55 String.fromCodePoint.apply(null, result); // must not throw | 53 String.fromCodePoint.apply(null, result); // must not throw |
56 | 54 |
57 var counter = Math.pow(2, 15) * 3 / 2; | 55 var counter = Math.pow(2, 15) * 3 / 2; |
58 var result = []; | 56 var result = []; |
59 while (--counter >= 0) { | 57 while (--counter >= 0) { |
60 result.push(0xFFFF + 1); // two code units per symbol | 58 result.push(0xFFFF + 1); // two code units per symbol |
61 } | 59 } |
62 String.fromCodePoint.apply(null, result); // must not throw | 60 String.fromCodePoint.apply(null, result); // must not throw |
OLD | NEW |