Skip to content

Commit 82926bc

Browse files
committed
add extra unit test
1 parent 131e805 commit 82926bc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/derive_delegate.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#[portrait::make]
2+
trait Foo {
3+
fn new(arg1: i32, arg2: &str, arg3: &mut i64) -> Self;
4+
fn print(&self);
5+
fn clone(&self) -> Self;
6+
#[portrait(derive_delegate(reduce = |a, b| a && b))]
7+
fn eq(&self, other: &Self) -> bool;
8+
}
9+
10+
#[portrait::fill(portrait::default)]
11+
impl Foo for i32 { }
12+
13+
#[portrait::fill(portrait::default)]
14+
impl Foo for String {}
15+
16+
#[portrait::derive(Foo with portrait::derive_delegate)]
17+
struct Fields {
18+
a: i32,
19+
b: String,
20+
}
21+
22+
fn main() {
23+
fn assert(_: impl Foo) {}
24+
25+
assert(Fields { a: 1, b: String::new() });
26+
}

0 commit comments

Comments
 (0)