-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to use return type in tests
Especially useful for types which use the try operator, `?` i.e. Result or Option, such that you can use ? instead of unwrapping everything. Accepted by the #[test] macro
- Loading branch information
1 parent
6fd232d
commit e26d00e
Showing
6 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use parameterized_macro::parameterized; | ||
|
||
#[parameterized(v = { 1, 2 })] | ||
fn my_test(v: i32) -> Result<(), ()> { | ||
Ok(()) | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use parameterized_macro::parameterized; | ||
|
||
#[parameterized(v = { 1, 2 })] | ||
fn my_test(v: i32) -> Result<(), ()> { | ||
let unit = Err(())?; | ||
Ok(unit) | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use parameterized_macro::parameterized; | ||
|
||
struct NotTry; | ||
|
||
#[parameterized(_v = { 1, 2 })] | ||
fn my_test(_v: i32) -> NotTry { | ||
NotTry | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters