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

Side by Side Diff: test/mjsunit/harmony/unicode-escapes.js

Issue 716423002: ES6 unicode extensions, part 1. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add tests Created 6 years 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/cctest/test-parsing.cc ('k') | no next file » | 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 // ES6 extends the \uxxxx escape and also allows \u{xxxxx}.
6
7 // Flags: --harmony-unicode
8
9 // Unicode escapes in variable names.
10
11 (function TestVariableNames1() {
12 var foobar = 1;
13 assertEquals(foob\u0061r, 1);
14 assertEquals(foob\u{0061}r, 1);
15 assertEquals(foob\u{61}r, 1);
16 assertEquals(foob\u{0000000061}r, 1);
17 })();
18
19 (function TestVariableNames2() {
20 var foobar = 1;
21 assertEquals(\u0066oobar, 1);
22 assertEquals(\u{0066}oobar, 1);
23 assertEquals(\u{66}oobar, 1);
24 assertEquals(\u{0000000066}oobar, 1);
25 })();
26
27 // Unicode escapes in strings.
28
29 (function TestStrings() {
30 var s1 = "foob\u0061r";
31 assertEquals(s1, "foobar");
32 var s2 = "foob\u{0061}r";
33 assertEquals(s2, "foobar");
34 var s3 = "foob\u{61}r";
35 assertEquals(s3, "foobar");
36 var s4 = "foob\u{0000000061}r";
37 assertEquals(s4, "foobar");
38 })();
39
40
41 (function TestSurrogates() {
42 // U+10E6D corresponds to the surrogate pair [U+D803, U+DE6D].
43 var s1 = "foo\u{10e6d}";
44 var s2 = "foo\u{d803}\u{de6d}";
45 assertEquals(s1, s2);
46 })();
OLDNEW
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698