test: scope bash guard assertion to configured cmd

This commit is contained in:
Kaiiiiiiiii 2026-03-07 15:31:18 +08:00
parent 6b71292dd1
commit 018299fb48
1 changed files with 5 additions and 1 deletions

View File

@ -74,7 +74,11 @@ mod tests {
) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Bash(&opts).render().unwrap();
assert!(source.contains("[[ -n ${__zoxide_result} ]] || return"));
if cmd.is_some() {
assert!(source.contains("[[ -n ${__zoxide_result} ]] || return"));
} else {
assert!(!source.contains("[[ -n ${__zoxide_result} ]] || return"));
}
}
#[apply(opts)]