kitamstudios / rust-analyzer.vs

Rust language support for Visual Studio 2022
https://marketplace.visualstudio.com/items?itemName=kitamstudios.RustAnalyzer
Other
147 stars 11 forks source link

Integration Tests #41

Closed mikeHag closed 6 months ago

mikeHag commented 10 months ago

I decided to try the extension with a package from the rust track of Exercism. All their exercises are libraries with integration tests. Here is an example directory: 12/01/2023 06:22 PM

. 12/05/2023 02:42 PM .. 12/01/2023 06:22 PM .exercism 12/01/2023 06:22 PM 260 .gitignore 12/01/2023 06:22 PM 161 Cargo.lock 12/01/2023 06:22 PM 72 Cargo.toml 12/01/2023 06:22 PM 2,963 HELP.md 12/01/2023 06:22 PM 2,134 README.md 12/01/2023 06:22 PM src 12/01/2023 06:22 PM target 12/01/2023 06:22 PM tests

src: 12/01/2023 06:22 PM

. 12/01/2023 06:22 PM .. 12/01/2023 06:22 PM 354 lib.rs

tests: 12/01/2023 06:22 PM

. 12/01/2023 06:22 PM .. 12/01/2023 06:22 PM 2,034 rail-fence-cipher.rs

Using VS Code, I can run individual tests or debug individual tests from within the window of the test file, rail-fence-cipher.rs in this case. I can also use the terminal to run cargo commands directly, eg., cargo test, or cargo test -- --ignored.

I have looked at the examples and watched most of the YouTube video, but I have not seen an example or demonstration of how to anything similar using the rust analyzer extension in Visual Studio.

Am I missing something?

Thanks

parthopdas commented 10 months ago

Yes I believe you are missing the "Features" section of this projects README file.

Here is a copy paste. lmk how it goes.

Workspaces & super workspaces both fully supported (super workspace is a folder with multiple cargo workspaces). Intellisense / Auto-complete / Goto definition / Code actions / Find references etc. all features from Rust language server. Build, Clean (errors in Error list with details in output window). Debug & Run without debugging. Run, debug & manage unit tests from test explorer. Examples support (run & debug). Set additional properties for build / debug / run (e.g. command line arguments). Clippy / Fmt integration. Comment (Ctrl+K Ctrl+C) & Uncomment (Ctrl+K Ctrl+U) Infrastructure features Extension Logs for debugging in Output | rust-analyzer.vs pane. Test integration requires changes currently in rust nightly toolchain. RFC is in progress to promote the changes to stable. Refer: https:// Tools | Options | rust-analyzer.vs

parthopdas commented 10 months ago

Specifically: Run, debug & manage unit tests from test explorer. - specifically note the rust nightly requirement.

mikeHag commented 10 months ago

Thanks for your response.

I believe that I can run and debug unit tests from the test explorer. I see that in your examples and also in the YouTube demonstration.

I hadn't seen a reference to integration tests but made the assumption that functionality might also be included. Now, I conclude that integration tests are not supported and that as an alternative I could change the integration tests to unit tests, add an "exe" to the mix and go from there. For working with the Exercism exercises, I think I will stick with VS Code - it is the path of least resistance.

When I start a new Rust project from scratch, I will switch back to Visual Studio with your extension.

Thanks again

parthopdas commented 10 months ago

I see what you mean. Integration tests are on the backlog but not sure when I'll get to it. Alternatively if someone from the community can get to it, it will be even better.

It would be great if you can attach a short stripped out sample of hello world integration test. Would be helpful for whoever picks this up next.

parthopdas commented 6 months ago

This has been released. There is a known issue if the integration tests across the workspace share the same filename then only one of them will show up. I am thinking a proper fix for this.

Otherwise lmk if you hit any issues.