mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 19:21:33 +03:00
25 lines
410 B
Rust
25 lines
410 B
Rust
|
use swc_config::merge::Merge;
|
||
|
|
||
|
#[derive(Merge)]
|
||
|
struct Fields {
|
||
|
a: Option<()>,
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn test_fields() {
|
||
|
let mut fields = Fields { a: None };
|
||
|
fields.merge(Fields { a: Some(()) });
|
||
|
|
||
|
assert_eq!(fields.a, Some(()));
|
||
|
}
|
||
|
|
||
|
#[derive(Merge)]
|
||
|
struct Tuple(Option<()>);
|
||
|
#[test]
|
||
|
fn test_tuple() {
|
||
|
let mut tuple = Tuple(None);
|
||
|
tuple.merge(Tuple(Some(())));
|
||
|
|
||
|
assert_eq!(tuple.0, Some(()));
|
||
|
}
|