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

Unified 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 side-by-side diff with in-line comments
Download patch
« src/scanner.cc ('K') | « src/scanner.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/templates.js
diff --git a/test/mjsunit/harmony/templates.js b/test/mjsunit/harmony/templates.js
index 86caf453a5c998f7cb6f9cabdde145aba400ad2d..ac6b1e7d4a24bb7f91c11d6dede6f8aea0fdf165 100644
--- a/test/mjsunit/harmony/templates.js
+++ b/test/mjsunit/harmony/templates.js
@@ -250,12 +250,6 @@ var obj = {
(function(s) { calls++; assertEquals("\u005C`", s.raw[0]); })`\``;
assertEquals(10, calls);
- // The TRV of CharacterEscapeSequence :: NonEscapeCharacter is the CV of the
- // NonEscapeCharacter.
- calls = 0;
- (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.
- assertEquals(1, calls);
-
// The TRV of LineTerminatorSequence :: <LF> is the code unit value 0x000A.
// The TRV of LineTerminatorSequence :: <CR> is the code unit value 0x000A.
// The TRV of LineTerminatorSequence :: <CR><LF> is the sequence consisting of
@@ -471,3 +465,21 @@ var obj = {
// block
}`jkl`;
})();
+
+
+(function testLegacyOctal() {
+ assertEquals('\u0000', `\0`);
+ assertEquals('123', `\123`);
+ assertThrows("`\\01`", SyntaxError);
+ assertThrows("`\\08`", SyntaxError);
+ 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
+
+ assertEquals('\\0', String.raw`\0`);
+ 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.
+})();
+
+
+(function testSyntaxErrorsNonEscapeCharacter() {
+ assertThrows("`\\x`", SyntaxError);
+ assertThrows("`\\u`", SyntaxError);
+})();
« 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