From 99f8e61ca1c2aa91ab474d690294195912e0c12f Mon Sep 17 00:00:00 2001 From: Nicolas Bigaouette Date: Sun, 10 Apr 2022 16:34:15 -0400 Subject: [PATCH] Add 'which' as dev-dependencies to detect 'fish' shell presence or not --- Cargo.lock | 12 ++++++++++++ Cargo.toml | 1 + tests/integration/setup/fish.rs | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index bd6846e..dac5bcf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -732,6 +732,7 @@ dependencies = [ "tokio", "url", "users", + "which", "zip", ] @@ -2270,6 +2271,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "which" +version = "4.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae" +dependencies = [ + "either", + "lazy_static", + "libc", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index f327636..9379d0c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,6 +67,7 @@ predicates = "2" indoc = "1" hygeia_test_helpers = { path = "hygeia_test_helpers" } rstest = "0.12" +which = "4.2.5" # pretty_assertions = "0.6" [target.'cfg(not(target_os = "windows"))'.dev-dependencies.users] diff --git a/tests/integration/setup/fish.rs b/tests/integration/setup/fish.rs index 10bc684..228e19f 100644 --- a/tests/integration/setup/fish.rs +++ b/tests/integration/setup/fish.rs @@ -3,6 +3,11 @@ use super::*; #[cfg_attr(windows, ignore)] #[test] fn setup_fish_success_from_scratch() { + if let Err(which::Error::CannotFindBinaryPath) = which::which("fish") { + eprintln!("Shell 'fish' not found; cannot run unit test 'setup_fish_success_from_scratch'"); + return; + } + let home = create_test_temp_dir!(); let hygeia_home = home.join(".hygeia"); let cwd = home.join("current_dir");