From 699a2b5c7ee900c1ff99b70f9b6402ded78d3b3b Mon Sep 17 00:00:00 2001 From: varkor Date: Thu, 12 Apr 2018 22:19:02 +0100 Subject: [PATCH] Add test for Debug formatting of char --- src/libcore/tests/char.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcore/tests/char.rs b/src/libcore/tests/char.rs index ab90763abf8..76f28d493ab 100644 --- a/src/libcore/tests/char.rs +++ b/src/libcore/tests/char.rs @@ -186,6 +186,14 @@ fn test_escape_debug() { assert_eq!(string('\u{100000}'), "\\u{100000}"); // private use 2 } +#[test] +fn test_debug() { + assert_eq!(format!("{:?}", 'a'), "'a'"); // ASCII character + assert_eq!(format!("{:?}", 'é'), "'é'"); // printable character + assert_eq!(format!("{:?}", '\u{301}'), "'\\u{301}'"); // combining character + assert_eq!(format!("{:?}", '\u{e000}'), "'\\u{e000}'"); // private use 1 +} + #[test] fn test_escape_default() { fn string(c: char) -> String {