1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:57:35 +00:00

LibJS: Handle hex and unicode escape sequences in string literals

Introduces the following syntax:

'\x55'
'\u26a0'
'\u{1f41e}'
This commit is contained in:
Matthew Olsson 2020-05-16 23:27:25 -07:00 committed by Andreas Kling
parent b3090678a9
commit e415dd4e9c
5 changed files with 118 additions and 9 deletions

View file

@ -0,0 +1,17 @@
load("test-common.js")
try {
assert("\x55" === "U");
assert("\X55" === "X55");
assert(`\x55` === "U");
assert(`\X55` === "X55");
assert("\u26a0" === "⚠");
assert(`\u26a0` === "⚠");
assert("\u{1f41e}" === "🐞");
assert(`\u{1f41e}` === "🐞");
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}