Skip to content

feat: Add support for custom test attributes#82

Merged
foresterre merged 1 commit intomainfrom
custom-macro-attr
Mar 5, 2024
Merged

feat: Add support for custom test attributes#82
foresterre merged 1 commit intomainfrom
custom-macro-attr

Conversation

@foresterre
Copy link
Copy Markdown
Owner

You may now add the attribute #[parameterized_macro(...)] after a #[parameterized(...)] attribute. The ... in the parameterized_macro may be replaced with a custom test attribute such as tokio::test.

As an additional treat (because the above would not half be as useful without some of these), the parameterized test function now also parses and provides codegen for the async, const and unsafe keywords, in addition to the also newly added support for specifying return types.

closes #80

You may now add the attribute #[parameterized_macro(...)] after a #[parameterized(...)] attribute. The ... in the parameterized_macro may be replaced with a custom test attribute such as tokio::test.

As an additional treat (because the above would not half be as useful without some of these), the parameterized test function now also parses and provides codegen for the async, const and unsafe keywords, in addition to the also newly added support for specifying return types.
@foresterre foresterre enabled auto-merge (rebase) March 5, 2024 07:07
@foresterre foresterre merged commit e018621 into main Mar 5, 2024
@foresterre
Copy link
Copy Markdown
Owner Author

This is now supported and will be released as 2.0.0

Example usage:

parameterized/src/lib.rs

Lines 95 to 111 in e018621

mod custom_test_attribute {
use super::*;
ide!();
#[parameterized(input = { true, true, true })]
#[parameterized_macro(tokio::test)]
async fn tokio_simple_meta(input: bool) {
assert!(input)
}
#[parameterized(input = { true, true, true })]
#[parameterized_macro(tokio::test(flavor = "multi_thread", worker_threads = 1))]
async fn tokio_complex_meta(input: bool) {
assert!(input)
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#[tokio::test] support

1 participant