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

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: moar 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..1f9788559d76e0c2a885576462334b29e3fc1931 100644
--- a/test/mjsunit/harmony/templates.js
+++ b/test/mjsunit/harmony/templates.js
@@ -253,7 +253,7 @@ var obj = {
// The TRV of CharacterEscapeSequence :: NonEscapeCharacter is the CV of the
// NonEscapeCharacter.
calls = 0;
- (function(s) { calls++; assertEquals("\u005Cx", s.raw[0]); })`\x`;
+ (function(s) { calls++; assertEquals("\u005Cz", s.raw[0]); })`\z`;
assertEquals(1, calls);
// The TRV of LineTerminatorSequence :: <LF> is the code unit value 0x000A.
@@ -471,3 +471,24 @@ var obj = {
// block
}`jkl`;
})();
+
+
+(function testLegacyOctal() {
+ assertEquals('\u0000', `\0`);
+ for (var i = 0; i < 10; i++) {
+ var code = "`\\0" + i + "`";
+ assertThrows(code, SyntaxError);
caitp (gmail) 2014/12/17 20:32:14 I think it would be good to also test `\0<nondigit
arv (Not doing code reviews) 2014/12/17 20:57:13 Done.
+ }
+
+ assertEquals('\\0', String.raw`\0`);
+})();
+
+
+(function testSyntaxErrorsNonEscapeCharacter() {
+ assertThrows("`\\x`", SyntaxError);
+ assertThrows("`\\u`", SyntaxError);
+ for (var i = 1; i < 10; i++) {
+ var code = "`\\" + i + "`";
+ assertThrows(code, 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