Skip to content

Commit c53a7bd

Browse files
committed
test(ast/estree): more tests for escaping strings in JSON (#11756)
There were no tests covering escaping backslashes in JSON. Add some.
1 parent c4faee2 commit c53a7bd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/oxc_estree/src/serialize/strings.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ mod tests {
475475
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F",
476476
r#""\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f""#,
477477
),
478+
(r"\r\n\q", r#""\\r\\n\\q""#),
478479
(
479480
r#"They call me "Bob" but I prefer "Dennis", innit?"#,
480481
r#""They call me \"Bob\" but I prefer \"Dennis\", innit?""#,
@@ -523,8 +524,8 @@ mod tests {
523524
("\u{FFFD}d834\u{FFFD}d835_y_", r#""\ud834\ud835_y_""#),
524525
("_x_\u{FFFD}d834_y_\u{FFFD}d835_z_", r#""_x_\ud834_y_\ud835_z_""#),
525526
(
526-
"They call me \"Bob\" but I prefer \"Den\u{FFFD}d834nis\", innit?",
527-
r#""They call me \"Bob\" but I prefer \"Den\ud834nis\", innit?""#,
527+
"They call me \"Bob\" but I prefer \"Den\u{FFFD}d834\\qnis\", innit?",
528+
r#""They call me \"Bob\" but I prefer \"Den\ud834\\qnis\", innit?""#,
528529
),
529530
];
530531

0 commit comments

Comments
 (0)