diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/issues/issue-8898.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-8898.rs b/src/test/ui/issues/issue-8898.rs new file mode 100644 index 000000000..31d5ff86e --- /dev/null +++ b/src/test/ui/issues/issue-8898.rs @@ -0,0 +1,18 @@ +// run-pass + +fn assert_repr_eq<T: std::fmt::Debug>(obj : T, expected : String) { + assert_eq!(expected, format!("{:?}", obj)); +} + +pub fn main() { + let abc = [1, 2, 3]; + let tf = [true, false]; + let x = [(), ()]; + let slice = &x[..1]; + + assert_repr_eq(&abc[..], "[1, 2, 3]".to_string()); + assert_repr_eq(&tf[..], "[true, false]".to_string()); + assert_repr_eq(&x[..], "[(), ()]".to_string()); + assert_repr_eq(slice, "[()]".to_string()); + assert_repr_eq(&x[..], "[(), ()]".to_string()); +} |