Skip to content
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 running and debugging individual tests with vscode codelldb #120

Closed
davidwalschots opened this issue May 17, 2021 · 3 comments
Closed

Comments

@davidwalschots
Copy link

Nice work on this testing library! I'd like to suggest looking into supporting the popular vscode
vadimcn.vscode-lldb extension. With it I can easily run and debug default Rust tests. Sadly doing the same with #[rstest] doesn't work at the moment.

@la10736
Copy link
Owner

la10736 commented May 18, 2021

Ok I took a look to this and is not related on codelldb but just to rust-analyzer run/debug lens. This len when find a test will start it with follow command:

cargo test --package <package> --bin <binary> -- <test_path> --exact --nocapture

(debug starts binary in target folder and with the last part that follow --)

Ok, that works if you use #[test] or a simple #[rstest] without cases or values because that test path name is exactly the same. But if you add a case your test will change its path and --exact option will fail.

You can work around this wrapping the test in a module and debug a module.

Anyway I'll take a look to rust-analyzer code to see if I can handle rstest case properly.

@la10736
Copy link
Owner

la10736 commented May 18, 2021

Relevant rust-analyzer code where to start: crates/rust-analyzer/src/cargo_target_spec.rs

@la10736
Copy link
Owner

la10736 commented May 24, 2021

Rust-analyzer's rust-lang/rust-analyzer#6029 should fix this issue.

bors bot added a commit to rust-lang/rust-analyzer that referenced this issue Jun 3, 2021
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>
bors bot added a commit to rust-lang/rust-analyzer that referenced this issue Jun 3, 2021
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>
@la10736 la10736 closed this as completed Oct 9, 2021
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

No branches or pull requests

2 participants