-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicated tests when combined with test_log
#146
Comments
I think to make this work the |
kezhuw
added a commit
to kezhuw/test-case
that referenced
this issue
Nov 19, 2024
This pr proposes a generic mechanism among different test proc macros to avoid to generate multiple `[::core::prelude::v1::test]` on test method. `proc_macro_attribute` function is fed with tokens after its attribute and no tokens before it. Give the above, this pr proposes test proc macros to append newly generated macros after existing ones. This way, proc macros processed later can read all macros including generated and handwritten and make further decisions. Specifically, proc macros can append `#[::core::prelude::v1::test]` only if it does not exist. Macros that transform test method signature can append `#[::core::prelude::v1::test]` directly without checking its existence once they generate valid signature for test method. Closes frondeus#101, frondeus#146.
kezhuw
added a commit
to kezhuw/test-case
that referenced
this issue
Nov 20, 2024
This pr proposes a generic mechanism among different test proc macros to avoid to generate multiple `[::core::prelude::v1::test]` on test method. `proc_macro_attribute` function is fed with tokens after its attribute and no tokens before it. Give the above, this pr proposes test proc macros to append newly generated macros after existing ones. This way, proc macros processed later can read all macros including generated and handwritten and make further decisions. Specifically, proc macros can append `#[::core::prelude::v1::test]` only if it does not exist. Macros that transform test method signature can append `#[::core::prelude::v1::test]` directly without checking its existence once they generate valid signature for test method. Closes frondeus#101, frondeus#146.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's unclear to me if this is really a bug or just the expected outcome of Rust's weird test case registration system.
Any idea if there's a workaround for that? In this case it's quite easy to drop
test_log
but I guess there might be many similar cases where the test wrapper macro is more valuable.The text was updated successfully, but these errors were encountered: