I'm developing code for the Codingame problems using VS Code on Windows with Rust and the Visual Studio toolchain.
I have found multiple guides explaining how to debug the executable generated by cargo build
, the best being Debug Rust on Windows with Visual Studio Code and the MSVC Debugger.
However, when I face problems, I tend to write unit tests (I've done that in Java, JavaScript, Ruby, ...), which I then debug. Unfortunately, I can't find any way to do that in Rust. How do I configure my environment to debug my tests?
I'm not talking about adding println!
statements in my tests, as I already know how to do that. I'm also not talking about adding new assertions, because those reside in the test, not in the tested code.
What I want is to use the VS Code Debugger on the code called by my test.
See Question&Answers more detail:os