mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
parent
079d42f68b
commit
d8063b6210
2 changed files with 12 additions and 2 deletions
|
|
@ -1339,7 +1339,9 @@ fn print_unquoted_str<const MINIFY: bool>(s: &str, quote: char, p: &mut Codegen<
|
|||
'\u{a0}' => {
|
||||
p.print_str(b"\\xA0");
|
||||
}
|
||||
_ => p.print_str(c.escape_default().to_string().as_bytes()),
|
||||
_ => {
|
||||
p.print_str(c.encode_utf8([0; 4].as_mut()).as_bytes());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ fn string() {
|
|||
test("let x = ''", "let x = '';\n", None);
|
||||
test(r"let x = '\b'", "let x = '\\b';\n", None);
|
||||
test(r"let x = '\f'", "let x = '\\f';\n", None);
|
||||
test("let x = '\t'", "let x = '\\t';\n", None);
|
||||
test("let x = '\t'", "let x = '\t';\n", None);
|
||||
test(r"let x = '\v'", "let x = '\\v';\n", None);
|
||||
test("let x = '\\n'", "let x = '\\n';\n", None);
|
||||
test("let x = '\\''", "let x = \"'\";\n", None);
|
||||
|
|
@ -390,3 +390,11 @@ const c2 = /* #__NO_SIDE_EFFECTS__ */ () => {
|
|||
",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unicode_escape() {
|
||||
test("console.log('你好');", "console.log('你好');\n", None);
|
||||
test("console.log('こんにちは');", "console.log('こんにちは');\n", None);
|
||||
test("console.log('안녕하세요');", "console.log('안녕하세요');\n", None);
|
||||
test("console.log('🧑🤝🧑');", "console.log('🧑🤝🧑');\n", None);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue