Skip to content

Commit c22d026

Browse files
committed
ifmt - Add a basic test for {:p} getting truncated
1 parent 4a22c33 commit c22d026

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/test/run-pass/ifmt.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ pub fn main() {
137137
t!(format!("{:+10.3e}", 1.2345e6f64), " +1.234e6");
138138
t!(format!("{:+10.3e}", -1.2345e6f64), " -1.234e6");
139139

140+
// Test that pointers don't get truncated.
141+
{
142+
let val = usize::MAX;
143+
let exp = format!("{:#x}", val);
144+
t!(format!("{:p}", val as *const isize), exp);
145+
}
146+
140147
// Escaping
141148
t!(format!("{{"), "{");
142149
t!(format!("}}"), "}");

0 commit comments

Comments
 (0)