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

Unified Diff: test/mjsunit/harmony/templates.js

Issue 768203002: Simplify template literal raw string creation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add harmony unicode test 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
« no previous file with comments | « 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 ee37d8241219a2de1aad479cd3648338c5689d3f..13d514610c043c3db91b1a07268cf3f001fb1a59 100644
--- a/test/mjsunit/harmony/templates.js
+++ b/test/mjsunit/harmony/templates.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-templates
+// Flags: --harmony-templates --harmony-unicode
var num = 5;
var str = "str";
@@ -428,3 +428,28 @@ var obj = {
function tag(){}
tag`a${1}b`;
})();
+
+
+(function testRawLineNormalization() {
+ function raw0(callSiteObj) {
+ return callSiteObj.raw[0];
+ }
+ assertEquals(eval("raw0`\r`"), "\n");
+ assertEquals(eval("raw0`\r\n`"), "\n");
+ assertEquals(eval("raw0`\r\r\n`"), "\n\n");
+ assertEquals(eval("raw0`\r\n\r\n`"), "\n\n");
+ assertEquals(eval("raw0`\r\r\r\n`"), "\n\n\n");
+})();
+
+
+(function testHarmonyUnicode() {
+ function raw0(callSiteObj) {
+ return callSiteObj.raw[0];
+ }
+ assertEquals(raw0`a\u{62}c`, "a\\u{62}c");
+ assertEquals(raw0`a\u{000062}c`, "a\\u{000062}c");
+ assertEquals(raw0`a\u{0}c`, "a\\u{0}c");
+
+ assertEquals(`a\u{62}c`, "abc");
+ assertEquals(`a\u{000062}c`, "abc");
+})();
« no previous file with comments | « src/scanner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698