Add fmt::Debug string escape tests

This commit is contained in:
Simon Mazur 2015-09-29 15:53:58 +03:00
parent 24b5d3afd7
commit 025ca11ab9

View File

@ -74,6 +74,10 @@ pub fn main() {
t!(format!("{:?}", 10_usize), "10");
t!(format!("{:?}", "true"), "\"true\"");
t!(format!("{:?}", "foo\nbar"), "\"foo\\nbar\"");
t!(format!("{:?}", "foo\n\"bar\"\r\n\'baz\'\t\\qux\\"),
r#""foo\n\"bar\"\r\n\'baz\'\t\\qux\\""#);
t!(format!("{:?}", "foo\0bar\x01baz\u{3b1}q\u{75}x"),
r#""foo\u{0}bar\u{1}baz\u{3b1}qux""#);
t!(format!("{:o}", 10_usize), "12");
t!(format!("{:x}", 10_usize), "a");
t!(format!("{:X}", 10_usize), "A");