From c22d026326f10f8a4e60d49c6fbf37de3c970a78 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 28 Feb 2015 22:51:29 +0800 Subject: [PATCH] ifmt - Add a basic test for {:p} getting truncated --- src/test/run-pass/ifmt.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index ab83fb90d3f..d54de8824e0 100644 --- a/src/test/run-pass/ifmt.rs +++ b/src/test/run-pass/ifmt.rs @@ -137,6 +137,13 @@ pub fn main() { t!(format!("{:+10.3e}", 1.2345e6f64), " +1.234e6"); t!(format!("{:+10.3e}", -1.2345e6f64), " -1.234e6"); + // Test that pointers don't get truncated. + { + let val = usize::MAX; + let exp = format!("{:#x}", val); + t!(format!("{:p}", val as *const isize), exp); + } + // Escaping t!(format!("{{"), "{"); t!(format!("}}"), "}");