diff options
Diffstat (limited to 'vendor/derive_builder/tests/setter_name.rs')
-rw-r--r-- | vendor/derive_builder/tests/setter_name.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/vendor/derive_builder/tests/setter_name.rs b/vendor/derive_builder/tests/setter_name.rs new file mode 100644 index 000000000..e1ddade84 --- /dev/null +++ b/vendor/derive_builder/tests/setter_name.rs @@ -0,0 +1,29 @@ +#[macro_use] +extern crate pretty_assertions; +#[macro_use] +extern crate derive_builder; + +#[derive(Debug, PartialEq, Default, Builder, Clone)] +#[builder(setter(prefix = "with"))] +struct Lorem { + ipsum: &'static str, + #[builder(setter(name = "foo"))] + pub dolor: &'static str, +} + +#[test] +fn renamed_setter() { + let x = LoremBuilder::default() + .with_ipsum("ipsum") + .foo("dolor") + .build() + .unwrap(); + + assert_eq!( + x, + Lorem { + ipsum: "ipsum", + dolor: "dolor", + } + ); +} |