summaryrefslogtreecommitdiffstats
path: root/vendor/derive_builder/tests/derive_trait.rs
blob: 0bb986d663f7d078a238ba0705da892186cc9555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#![allow(dead_code)]

#[macro_use]
extern crate derive_builder;

#[derive(Debug, Default, Clone)]
struct NotPartialEq(String);

#[derive(Debug, Clone, Builder)]
#[builder(derive(Debug, PartialEq, Eq))]
struct Lorem {
    foo: u8,

    /// This type doesn't have `PartialEq` support, but that's fine
    /// since we don't want it in the builder.
    #[builder(setter(skip))]
    excluded: NotPartialEq,
}

#[test]
fn defaults() {
    // This macro requires that the two sides implement `PartialEq` AND `Debug`,
    // so this one line is testing that the requested traits were really generated.
    assert_eq!(LoremBuilder::default(), LoremBuilder::default());
}