assert_cmd::cargo::cargo_bin returns incorrect path when used from integration tests. The tests are ran from the build-dir, but assert_cmd expects them to be in the target-dir.
|
// Adapted from |
|
// https://github.com/rust-lang/cargo/blob/485670b3983b52289a2f353d589c57fae2f60f82/tests/testsuite/support/mod.rs#L507 |
|
fn target_dir() -> path::PathBuf { |
|
env::current_exe() |
|
.ok() |
|
.map(|mut path| { |
|
path.pop(); |
|
if path.ends_with("deps") { |
|
path.pop(); |
|
} |
|
path |
|
}) |
|
.expect("this should only be used where a `current_exe` can be set") |
|
} |
The same code in snapbox is already deprecated:
https://github.com/assert-rs/snapbox/blob/90fd7f0c6d9e0d462bfcaa3a8df66a462a2be28a/crates/snapbox/src/cmd.rs#L854-L877
assert_cmd::cargo::cargo_binreturns incorrect path when used from integration tests. The tests are ran from thebuild-dir, butassert_cmdexpects them to be in thetarget-dir.assert_cmd/src/cargo.rs
Lines 220 to 233 in ee88946
The same code in
snapboxis already deprecated:https://github.com/assert-rs/snapbox/blob/90fd7f0c6d9e0d462bfcaa3a8df66a462a2be28a/crates/snapbox/src/cmd.rs#L854-L877