Skip to content

Commit d827973

Browse files
committed
Add regression test of \0 escaping for issue 363
1 parent c4a3e19 commit d827973

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/test.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ fn literal_string() {
114114
assert_eq!(Literal::string("foo").to_string(), "\"foo\"");
115115
assert_eq!(Literal::string("\"").to_string(), "\"\\\"\"");
116116
assert_eq!(Literal::string("didn't").to_string(), "\"didn't\"");
117+
assert_eq!(
118+
Literal::string("a\00b\07c\08d\0e\0").to_string(),
119+
"\"a\\00b\\07c\\08d\\0e\\0\"",
120+
);
117121
}
118122

119123
#[test]
@@ -147,6 +151,10 @@ fn literal_byte_string() {
147151
Literal::byte_string(b"\0\t\n\r\"\\2\x10").to_string(),
148152
"b\"\\0\\t\\n\\r\\\"\\\\2\\x10\"",
149153
);
154+
assert_eq!(
155+
Literal::byte_string(b"a\00b\07c\08d\0e\0").to_string(),
156+
"b\"a\\00b\\07c\\08d\\0e\\0\"",
157+
);
150158
}
151159

152160
#[test]

0 commit comments

Comments
 (0)