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

Side by Side Diff: test/mjsunit/harmony/templates.js

Issue 811113002: ES6 template literals should not use legacy octal strings (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix some more syntax errors 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
« src/scanner.cc ('K') | « src/scanner.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
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-templates --harmony-unicode 5 // Flags: --harmony-templates --harmony-unicode
6 6
7 var num = 5; 7 var num = 5;
8 var str = "str"; 8 var str = "str";
9 function fn() { return "result"; } 9 function fn() { return "result"; }
10 var obj = { 10 var obj = {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 (function(s) { calls++; assertEquals("\u005C\u005C", s.raw[0]); })`\\`; 243 (function(s) { calls++; assertEquals("\u005C\u005C", s.raw[0]); })`\\`;
244 (function(s) { calls++; assertEquals("\u005Cb", s.raw[0]); })`\b`; 244 (function(s) { calls++; assertEquals("\u005Cb", s.raw[0]); })`\b`;
245 (function(s) { calls++; assertEquals("\u005Cf", s.raw[0]); })`\f`; 245 (function(s) { calls++; assertEquals("\u005Cf", s.raw[0]); })`\f`;
246 (function(s) { calls++; assertEquals("\u005Cn", s.raw[0]); })`\n`; 246 (function(s) { calls++; assertEquals("\u005Cn", s.raw[0]); })`\n`;
247 (function(s) { calls++; assertEquals("\u005Cr", s.raw[0]); })`\r`; 247 (function(s) { calls++; assertEquals("\u005Cr", s.raw[0]); })`\r`;
248 (function(s) { calls++; assertEquals("\u005Ct", s.raw[0]); })`\t`; 248 (function(s) { calls++; assertEquals("\u005Ct", s.raw[0]); })`\t`;
249 (function(s) { calls++; assertEquals("\u005Cv", s.raw[0]); })`\v`; 249 (function(s) { calls++; assertEquals("\u005Cv", s.raw[0]); })`\v`;
250 (function(s) { calls++; assertEquals("\u005C`", s.raw[0]); })`\``; 250 (function(s) { calls++; assertEquals("\u005C`", s.raw[0]); })`\``;
251 assertEquals(10, calls); 251 assertEquals(10, calls);
252 252
253 // The TRV of CharacterEscapeSequence :: NonEscapeCharacter is the CV of the
254 // NonEscapeCharacter.
255 calls = 0;
256 (function(s) { calls++; assertEquals("\u005Cx", s.raw[0]); })`\x`;
caitp (gmail) 2014/12/17 19:35:56 Maybe just replace `\x` with `\z` or something?
arv (Not doing code reviews) 2014/12/17 20:22:07 Done.
257 assertEquals(1, calls);
258
259 // The TRV of LineTerminatorSequence :: <LF> is the code unit value 0x000A. 253 // The TRV of LineTerminatorSequence :: <LF> is the code unit value 0x000A.
260 // The TRV of LineTerminatorSequence :: <CR> is the code unit value 0x000A. 254 // The TRV of LineTerminatorSequence :: <CR> is the code unit value 0x000A.
261 // The TRV of LineTerminatorSequence :: <CR><LF> is the sequence consisting of 255 // The TRV of LineTerminatorSequence :: <CR><LF> is the sequence consisting of
262 // the code unit value 0x000A. 256 // the code unit value 0x000A.
263 calls = 0; 257 calls = 0;
264 function testRawLineNormalization(cs) { 258 function testRawLineNormalization(cs) {
265 calls++; 259 calls++;
266 assertEquals(cs.raw[0], "\n\n\n"); 260 assertEquals(cs.raw[0], "\n\n\n");
267 assertEquals(cs.raw[1], "\n\n\n"); 261 assertEquals(cs.raw[1], "\n\n\n");
268 } 262 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 458
465 { 459 {
466 // block 460 // block
467 } 461 }
468 `ghi`; 462 `ghi`;
469 463
470 { 464 {
471 // block 465 // block
472 }`jkl`; 466 }`jkl`;
473 })(); 467 })();
468
469
470 (function testLegacyOctal() {
471 assertEquals('\u0000', `\0`);
472 assertEquals('123', `\123`);
473 assertThrows("`\\01`", SyntaxError);
474 assertThrows("`\\08`", SyntaxError);
475 assertThrows("`\\01`", SyntaxError);
caitp (gmail) 2014/12/17 19:35:56 This looks like a duplicate \00, \01, \02, \03, \
arv (Not doing code reviews) 2014/12/17 20:22:07 Adding more tests
476
477 assertEquals('\\0', String.raw`\0`);
478 assertEquals('\\123', String.raw`\123`);
caitp (gmail) 2014/12/17 19:35:56 My reading of the spec is that this should be a Sy
arv (Not doing code reviews) 2014/12/17 20:22:07 You are right. Fixing.
479 })();
480
481
482 (function testSyntaxErrorsNonEscapeCharacter() {
483 assertThrows("`\\x`", SyntaxError);
484 assertThrows("`\\u`", SyntaxError);
485 })();
OLDNEW
« src/scanner.cc ('K') | « src/scanner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698