From 82b6300dcb0874cf1b9c85675107a56b5b732390 Mon Sep 17 00:00:00 2001 From: nibon7 Date: Mon, 15 Mar 2021 11:59:04 +0800 Subject: [PATCH] fix: cargo test failed with --release (#3183) (#3184) Signed-off-by: nibon7 --- crates/nu-test-support/src/fs.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/nu-test-support/src/fs.rs b/crates/nu-test-support/src/fs.rs index c9ef2fa247..74ba94b9ad 100644 --- a/crates/nu-test-support/src/fs.rs +++ b/crates/nu-test-support/src/fs.rs @@ -246,10 +246,15 @@ pub fn root() -> PathBuf { } pub fn binaries() -> PathBuf { + let mut build_type = "debug"; + if !cfg!(debug_assertions) { + build_type = "release" + } + std::env::var("CARGO_TARGET_DIR") .ok() - .map(|target_dir| PathBuf::from(target_dir).join("debug")) - .unwrap_or_else(|| root().join("target/debug")) + .map(|target_dir| PathBuf::from(target_dir).join(&build_type)) + .unwrap_or_else(|| root().join(format!("target/{}", &build_type))) } pub fn fixtures() -> PathBuf {