about summary refs log tree commit diff
path: root/tests/ui/issues/issue-8898.rs
blob: 4447704f059c23c0155bcd334e1718e16db0830f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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());
}