Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(935)

Side by Side Diff: test/mjsunit/harmony/string-fromcodepoint.js

Issue 1024813002: Remove harmony-strings flag. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/harmony/string-endswith.js ('k') | test/mjsunit/harmony/string-includes.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 // Flags: --harmony-strings
6
7 // Tests taken from:
8 // https://github.com/mathiasbynens/String.fromCodePoint
9
10 assertEquals(String.fromCodePoint.length, 1);
11 assertEquals(String.propertyIsEnumerable("fromCodePoint"), false);
12
13 assertEquals(String.fromCodePoint(""), "\0");
14 assertEquals(String.fromCodePoint(), "");
15 assertEquals(String.fromCodePoint(-0), "\0");
16 assertEquals(String.fromCodePoint(0), "\0");
17 assertEquals(String.fromCodePoint(0x1D306), "\uD834\uDF06");
18 assertEquals(
19 String.fromCodePoint(0x1D306, 0x61, 0x1D307),
20 "\uD834\uDF06a\uD834\uDF07");
21 assertEquals(String.fromCodePoint(0x61, 0x62, 0x1D307), "ab\uD834\uDF07");
22 assertEquals(String.fromCodePoint(false), "\0");
23 assertEquals(String.fromCodePoint(null), "\0");
24
25 assertThrows(function() { String.fromCodePoint("_"); }, RangeError);
26 assertThrows(function() { String.fromCodePoint("+Infinity"); }, RangeError);
27 assertThrows(function() { String.fromCodePoint("-Infinity"); }, RangeError);
28 assertThrows(function() { String.fromCodePoint(-1); }, RangeError);
29 assertThrows(function() { String.fromCodePoint(0x10FFFF + 1); }, RangeError);
30 assertThrows(function() { String.fromCodePoint(3.14); }, RangeError);
31 assertThrows(function() { String.fromCodePoint(3e-2); }, RangeError);
32 assertThrows(function() { String.fromCodePoint(-Infinity); }, RangeError);
33 assertThrows(function() { String.fromCodePoint(+Infinity); }, RangeError);
34 assertThrows(function() { String.fromCodePoint(NaN); }, RangeError);
35 assertThrows(function() { String.fromCodePoint(undefined); }, RangeError);
36 assertThrows(function() { String.fromCodePoint({}); }, RangeError);
37 assertThrows(function() { String.fromCodePoint(/./); }, RangeError);
38 assertThrows(function() { String.fromCodePoint({
39 valueOf: function() { throw Error(); } });
40 }, Error);
41 assertThrows(function() { String.fromCodePoint({
42 valueOf: function() { throw Error(); } });
43 }, Error);
44 var tmp = 0x60;
45 assertEquals(String.fromCodePoint({
46 valueOf: function() { ++tmp; return tmp; }
47 }), "a");
48 assertEquals(tmp, 0x61);
49
50 var counter = Math.pow(2, 15) * 3 / 2;
51 var result = [];
52 while (--counter >= 0) {
53 result.push(0); // one code unit per symbol
54 }
55 String.fromCodePoint.apply(null, result); // must not throw
56
57 var counter = Math.pow(2, 15) * 3 / 2;
58 var result = [];
59 while (--counter >= 0) {
60 result.push(0xFFFF + 1); // two code units per symbol
61 }
62 String.fromCodePoint.apply(null, result); // must not throw
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/string-endswith.js ('k') | test/mjsunit/harmony/string-includes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698