Skip to content

Commit cd72645

Browse files
committed
Fix a non-working (and non-failing) test
My changes have broken a test, which actually was actually incorrect twice: it wasn't doing the right thing (forwarding the From impl to the field type), but it wasn't testing the right thing either so it succeeded. Make the test actually check that from forwarding works, and make the forwarding actually work.
1 parent 4f41cd0 commit cd72645

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

tests/lib.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,17 @@ struct Unit;
169169
// containing `$crate`
170170
macro_rules! use_dollar_crate {
171171
() => {
172-
struct Foo;
173-
#[derive(From)]
172+
#[derive(From, Debug, PartialEq)]
173+
struct Foo(u32);
174+
#[derive(From, Debug, PartialEq)]
174175
enum Bar {
175-
First(#[from(forward)] $crate::Foo),
176+
#[from(forward)]
177+
First($crate::Foo),
178+
}
179+
180+
#[test]
181+
fn test_dollar_crate() {
182+
assert_eq!(Bar::First(Foo(123)), 123.into());
176183
}
177184
};
178185
}

0 commit comments

Comments
 (0)