-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support for #[rstest] tests #8964
Comments
Special casing crates like that isn't really something we want to do I think. The main problem here right now is that we don't currently expand attribute macros yet. Once we do we can handle these better though by looking at the expansion for test attributes potentially. Then we could probably just have the lens execute all the tests that the expansion created instead which should fix this. At least I believe it should work like this. |
Ok, reasonable. If I was the rust-analyzer maintainer maybe I had said the same thing. As workaround can we make the |
Ok, we're waiting for #6029. Should be fix almost all. |
Ye, attribute macros should come soon-ish at which point this can be tackled 👍 #8971 |
9128: feat: expand procedural attribute macros r=jonas-schievink a=jonas-schievink This adds experimental support for attribute macros. They can be enabled by setting `rust-analyzer.experimental.procAttrMacros` to `true`. Known issues: * Tokens aren't remapped, presumably because we edit the input syntax tree (this causes IDE features to not work inside items with attribute macros on them) * Macro errors aren't reported correctly Closes #8971 Fixes #8964 / la10736/rstest#120 Fixes #2984 Fixes #5412 Fixes #6029 Fixes #6687 #6740 is still not fixed – we now expand `#[proc_macro_hack]`, but fail to expand the resulting `proc_macro_call!()` macro. Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
So I think we probably wanna show |
Veykril@5602f0e |
Wow!!! That's really amazing!!! |
Hi,
an user of my crate ask a way to debug (but also just run today fails)
#[rstest]
's tests la10736/rstest#120 . Today the lens appear correctly but the runner execute something likeThat's ok if you have just a single test that use only fixtures but in the case you have cases or value list the procedural macro create a module that contains test functions or other modules.
So maybe in this case the best would be identify this as a Test module like it is.
Today rust-analyzer use a simple heuristic to identify test function (last argument path segment contains
test
word) and this work well to findrstest
's ones, but look just hir cannot be useful to find howrstest
expand it and crate a test module.So if you are ok I can create a PR that simply catch
rstest
inrunnable_fn
and return aRunnableKind::TestMod
instead of aRunnableKind::Test
.I know that a catch of explicit
rstest
is not the best but I don't have any better idea.Let me know if you like it and I can send a PR.
The text was updated successfully, but these errors were encountered: