Skip to content

Commit aa8a67d

Browse files
committed
Add a test for derive_builder crate
1 parent aa015f5 commit aa8a67d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/derive_builder.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use derive_builder::Builder;
2+
3+
#[test]
4+
fn builder() {
5+
#[derive(Builder, Debug, PartialEq)]
6+
struct Person {
7+
name: Option<String>,
8+
age: Option<u32>,
9+
}
10+
11+
assert_eq!(
12+
PersonBuilder::default()
13+
.name(Some("John".to_owned()))
14+
.age(Some(20))
15+
.build()
16+
.unwrap(),
17+
Person {
18+
name: Some("John".to_owned()),
19+
age: Some(20),
20+
},
21+
);
22+
}

0 commit comments

Comments
 (0)