In VS Code it is possible to run individual tests or individual module tests using buttons added right inside the text editor. It is very handy.
But I have to questions:
Is it possible to specify custom arguments to test build? I.e. "--target" or "--release".
When using additional attributes, like timeout
from ntest
these buttons do not show up. Can this be fixed?
kpreid
August 24, 2023, 3:14pm
2
For question 1, you can do it project-wide with the setting rust-analyzer.runnables.extraArgs
.
1 Like
For 2, does reversing make a difference...
#[timeout(500)]
#[test]
fn test_pt1_result() -> Result<()> {
I think it's a bug in ntest
. other attributes works fine. for example, you can test it out by defining an identity
proc macro attribute yourself like this:
#[proc_macro_attribute]
pub fn identity(_attrs: TokenStream, item: TokenStream) -> TokenStream {
item
}
#[test]
#[dummy::identity]
fn test() {}
Coding-Badly:
For 2, does reversing make a difference...
#[timeout(500)]
#[test]
fn test_pt1_result() -> Result<()> {
It makes the test not recognizable by the rust test framework. cargo test
will skip this test like it does not exist.
It works. Not sure about the side effects as it can affect something else.
Huh. That seems like a bug. Bummer.