Skip to content

Commit

Permalink
Add regression test of \0 escaping for issue 363
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 3, 2023
1 parent c4a3e19 commit d827973
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ fn literal_string() {
assert_eq!(Literal::string("foo").to_string(), "\"foo\"");
assert_eq!(Literal::string("\"").to_string(), "\"\\\"\"");
assert_eq!(Literal::string("didn't").to_string(), "\"didn't\"");
assert_eq!(
Literal::string("a\00b\07c\08d\0e\0").to_string(),
"\"a\\00b\\07c\\08d\\0e\\0\"",
);
}

#[test]
Expand Down Expand Up @@ -147,6 +151,10 @@ fn literal_byte_string() {
Literal::byte_string(b"\0\t\n\r\"\\2\x10").to_string(),
"b\"\\0\\t\\n\\r\\\"\\\\2\\x10\"",
);
assert_eq!(
Literal::byte_string(b"a\00b\07c\08d\0e\0").to_string(),
"b\"a\\00b\\07c\\08d\\0e\\0\"",
);
}

#[test]
Expand Down

0 comments on commit d827973

Please sign in to comment.