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:
parent
b3090678a9
commit
e415dd4e9c
5 changed files with 118 additions and 9 deletions
17
Libraries/LibJS/Tests/string-escapes.js
Normal file
17
Libraries/LibJS/Tests/string-escapes.js
Normal 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue