diff options
Diffstat (limited to 'test/transpiler/transpiler.test.js')
-rw-r--r-- | test/transpiler/transpiler.test.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/transpiler/transpiler.test.js b/test/transpiler/transpiler.test.js index 81cb367c3..3040a9913 100644 --- a/test/transpiler/transpiler.test.js +++ b/test/transpiler/transpiler.test.js @@ -2906,6 +2906,47 @@ console.log(foo, array); }); }); + it("raw template literal contents", () => { + expectPrinted("String.raw`\r`", "String.raw`\n`"); + expectPrinted("String.raw`\r\n`", "String.raw`\n`"); + expectPrinted("String.raw`\n`", "String.raw`\n`"); + expectPrinted("String.raw`\r\r\r\r\r\n\r`", "String.raw`\n\n\n\n\n\n`"); + expectPrinted("String.raw`\n\r`", "String.raw`\n\n`"); + var code = `String.raw\` + <head> + <meta charset="UTF-8" /> + <title>${"meow123"}</title> + <link rel="stylesheet" href="/css/style.css" /> + </head> + \``; + var result = code; + expectPrinted(code, code); + + code = `String.raw\` + <head>\r\n\n\r\r\r + <meta charset="UTF-8" />\r + <title>${"meow123"}</title>\n + + \r + \r + \n\r + <link rel="stylesheet" href="/css/style.css" /> + </head> + \``; + result = `String.raw\` + <head>\n\n\n\n + <meta charset="UTF-8" /> + <title>${"meow123"}</title>\n + + + + \n + <link rel="stylesheet" href="/css/style.css" /> + </head> + \``; + expectPrinted(code, result); + }); + describe("scan", () => { it("reports all export names", () => { const { imports, exports } = transpiler.scan(code); |