Skip to content

Workspace + Library Tests = Wrong Base Directory #231

Answered by mrcjkb
ekhar asked this question in Q&A
Discussion options

You must be logged in to vote

Hey 👋

rustaceanvim just runs the command with the arguments it receives from rust-analyzer, so there's nothing I can do here work around this issue.

If you have test resources, I suggest you put your file in resources/test and use the CARGO_MANIFEST_DIR environment variable.

For example:

let mut test_manifest_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
test_manifest_path.push("resources/test/tester.txt");

I've just tested this with one of the projects I work with, and it works just fine with :RustLsp debuggables.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by mrcjkb
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #229 on February 12, 2024 20:35.