summaryrefslogtreecommitdiffstats
path: root/vendor/displaydoc/tests/num_in_field.rs
blob: 9510f8206bd469f4a24d07cfdf1d96a0a0ecb994 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/// {foo1} {foo2}
#[derive(displaydoc::Display)]
pub struct Test {
    foo1: String,
    foo2: String,
}

fn assert_display<T: std::fmt::Display>(input: T, expected: &'static str) {
    let out = format!("{}", input);
    assert_eq!(expected, out);
}

#[test]
fn does_it_print() {
    assert_display(
        Test {
            foo1: "hi".into(),
            foo2: "hello".into(),
        },
        "hi hello",
    );
}