2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2015-01-20 23:45:07 +00:00
|
|
|
fn assert_repr_eq<T: std::fmt::Debug>(obj : T, expected : String) {
|
2014-12-20 08:09:35 +00:00
|
|
|
assert_eq!(expected, format!("{:?}", obj));
|
2013-09-02 01:32:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
2015-01-20 23:45:07 +00:00
|
|
|
let abc = [1, 2, 3];
|
2013-09-02 01:32:03 +00:00
|
|
|
let tf = [true, false];
|
|
|
|
let x = [(), ()];
|
2015-01-12 21:59:18 +00:00
|
|
|
let slice = &x[..1];
|
2013-09-02 01:32:03 +00:00
|
|
|
|
2015-02-05 16:58:30 +00:00
|
|
|
assert_repr_eq(&abc[..], "[1, 2, 3]".to_string());
|
|
|
|
assert_repr_eq(&tf[..], "[true, false]".to_string());
|
|
|
|
assert_repr_eq(&x[..], "[(), ()]".to_string());
|
2014-10-15 01:07:11 +00:00
|
|
|
assert_repr_eq(slice, "[()]".to_string());
|
2015-02-05 16:58:30 +00:00
|
|
|
assert_repr_eq(&x[..], "[(), ()]".to_string());
|
2013-09-02 01:32:03 +00:00
|
|
|
}
|