You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have workspace project with libraries defined in Cargo.toml like this:
[workspace]
members = ["crates/*"]
When running a test in on of workspace member library collection, which start like this:
#[test]fntest_creation(){let base_path = PathBuf::from("../../test_data");println!("Current dir is {:?}", std::env::current_dir().unwrap());assert!(base_path.is_dir());// ...}
I do get different results when using "Run Test" and "Debug" annotations links (above test function).
"Run Test" is using library package dir (project_dir/crates/collection) as current_dir and is ok, "Debug" is using project dir as working dir and fails.
The former is also behavior if test is run from cmd line:
cargo test -p collection test_creation -- --nocapture
where also package dir is used as working dir.
Same is happening when using predefined configuration in launch.json "Debug unit tests in library 'collection'", however that can be fixed by changing cwd to "${workspaceFolder}/crates/collection".
This inconsistency should be fixed and "Debug" should use same working directory as "Run Test".
Also generated debug configs for workspace libraries in launch.json should reflect that.
The text was updated successfully, but these errors were encountered:
rust-analyzer version: 0.3.1463-standalone
rustc version: rustc 1.65.0 (897e37553 2022-11-02)
I have workspace project with libraries defined in Cargo.toml like this:
When running a test in on of workspace member library collection, which start like this:
I do get different results when using "Run Test" and "Debug" annotations links (above test function).
"Run Test" is using library package dir (project_dir/crates/collection) as current_dir and is ok, "Debug" is using project dir as working dir and fails.
The former is also behavior if test is run from cmd line:
cargo test -p collection test_creation -- --nocapture
where also package dir is used as working dir.
Same is happening when using predefined configuration in launch.json "Debug unit tests in library 'collection'", however that can be fixed by changing
cwd
to "${workspaceFolder}/crates/collection".This inconsistency should be fixed and "Debug" should use same working directory as "Run Test".
Also generated debug configs for workspace libraries in launch.json should reflect that.
The text was updated successfully, but these errors were encountered: