diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 0a44d1fb414..2c7c55418da 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -1329,9 +1329,7 @@ fn escape_char(c: char) -> str { '\n' { "\\n" } '\t' { "\\t" } '\r' { "\\r" } - // FIXME: uncomment this when extfmt is moved to core - // in a snapshot. - // '\x00' to '\x1f' { #fmt["\\x%02x", c as uint] } + '\x00' to '\x1f' { #fmt["\\x%02x", c as uint] } v { from_char(c) } } } @@ -2297,6 +2295,11 @@ mod tests { assert(escape("abc\"def") == "abc\\\"def"); } + #[test] + fn test_escape_char() { + assert escape_char('\x1f') == "\\x1f"; + } + #[test] fn test_map() { assert "" == map("", char::to_upper);