cargo_test_support/
install.rs
1use std::env::consts::EXE_SUFFIX;
4use std::path::Path;
5
6#[track_caller]
15pub fn assert_has_installed_exe<P: AsRef<Path>>(path: P, name: &'static str) {
16 assert!(check_has_installed_exe(path, name));
17}
18
19#[track_caller]
20pub fn assert_has_not_installed_exe<P: AsRef<Path>>(path: P, name: &'static str) {
21 assert!(!check_has_installed_exe(path, name));
22}
23
24fn check_has_installed_exe<P: AsRef<Path>>(path: P, name: &'static str) -> bool {
25 path.as_ref().join("bin").join(exe(name)).is_file()
26}
27
28pub fn exe(name: &str) -> String {
30 format!("{}{}", name, EXE_SUFFIX)
31}