-
Notifications
You must be signed in to change notification settings - Fork 7
Add support for #[should_panic] macro
#151
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
Merged
Merged
Conversation
This file contains hidden or 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
0ff7c92 to
1cf8554
Compare
Pull Request Test Coverage Report for Build 19136819629Details
💛 - Coveralls |
epage
reviewed
Nov 3, 2025
epage
reviewed
Nov 3, 2025
epage
reviewed
Nov 3, 2025
epage
reviewed
Nov 3, 2025
epage
reviewed
Nov 3, 2025
epage
reviewed
Nov 3, 2025
epage
reviewed
Nov 3, 2025
epage
reviewed
Nov 3, 2025
epage
reviewed
Nov 3, 2025
epage
reviewed
Nov 3, 2025
epage
reviewed
Nov 3, 2025
dea0e5f to
dd8b78b
Compare
The `test_parse` macro is changed to recursively parse attributes, filtering out the `#[ignore]` macro. This should also make it fairly trivial to add additional macros, such as `#[should_ignore]`. There is a fair amount of complexity added to the macro with this change, but on the other hand, it also succeeds in generating only the necessary code. You win some, you lose some.
9f793d1 to
81988b6
Compare
epage
reviewed
Nov 5, 2025
Collaborator
|
Thanks, this is looking great! |
2731bc1 to
ce0bd7c
Compare
ce0bd7c to
23e0c85
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is done by recursively parsing attributes following the
#[libtest2::test]macro, and then parsing the first#[should_panic]macro encountered. If a macro is encountered then the test will be run within acatch_unwind, which is done by wrapping it in theassert_panicmacro (function style).Potentially supporting multiple
#[should_panic]macros is left for the future.Fixes #15