diff options
author | davidot <davidot@serenityos.org> | 2022-11-14 21:52:58 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-11-15 12:00:36 +0000 |
commit | b3edd9486966b8ec611a117335bce676dbc12161 (patch) | |
tree | 01a735994e5a8b5c06267d110c5d0e4d1895280e /Userland/Libraries/LibJS/Tests/template-literals.js | |
parent | 8e624c8f6dd891abf02dadba803436173e7cc344 (diff) | |
download | serenity-b3edd9486966b8ec611a117335bce676dbc12161.zip |
LibJS: Treat '\\' as an escaped character in template literals
Before this change we would ignore that the second backslash is escaped
and template strings ending with ` \\` would be unterminated as the
second slash was used to escape the closing quote.
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/template-literals.js')
-rw-r--r-- | Userland/Libraries/LibJS/Tests/template-literals.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/template-literals.js b/Userland/Libraries/LibJS/Tests/template-literals.js index 985be79fa1..5bbe8590cc 100644 --- a/Userland/Libraries/LibJS/Tests/template-literals.js +++ b/Userland/Libraries/LibJS/Tests/template-literals.js @@ -7,6 +7,9 @@ test("plain literals with expression-like characters", () => { test("plain literals with escaped special characters", () => { expect(`foo\``).toBe("foo`"); + expect(`foo\\`).toBe("foo\\"); + expect(`foo\\\``).toBe("foo\\`"); + expect(`foo\\\\`).toBe("foo\\\\"); expect(`foo\$`).toBe("foo$"); expect(`foo \${"bar"}`).toBe('foo ${"bar"}'); }); |