From d0faed242dcf54f6fd77fc1336cbdaa8294a9272 Mon Sep 17 00:00:00 2001 From: Earth Engine Date: Fri, 19 Jun 2020 15:42:58 +1000 Subject: [PATCH 1/2] Add unit test for issue 55 --- tests/throws.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/throws.rs b/tests/throws.rs index d44b80d..876cc7d 100644 --- a/tests/throws.rs +++ b/tests/throws.rs @@ -101,3 +101,18 @@ mod foo { throw!(0); } } + +mod foo_trait { + use fehler::throws; + trait FooTrait {} + + struct FooStruct; + + struct FooError; + impl FooTrait for FooStruct {} + + #[throws] + fn foo() -> Box { + Box::new(FooStruct) + } +} \ No newline at end of file From 2edcec39cb01f77053cc5bbadead1aa089057d77 Mon Sep 17 00:00:00 2001 From: Earth Engine Date: Fri, 19 Jun 2020 15:46:33 +1000 Subject: [PATCH 2/2] Fix and rename --- tests/throws.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/throws.rs b/tests/throws.rs index 876cc7d..88b693e 100644 --- a/tests/throws.rs +++ b/tests/throws.rs @@ -102,7 +102,7 @@ mod foo { } } -mod foo_trait { +mod foo_trait_obj { use fehler::throws; trait FooTrait {} @@ -111,7 +111,7 @@ mod foo_trait { struct FooError; impl FooTrait for FooStruct {} - #[throws] + #[throws(FooError)] fn foo() -> Box { Box::new(FooStruct) }