Files
nvm/test
Jordan Harband 26fef4fe1a [Tests] nvm_print_color_legend: check for the function, not a same-named file
The presence checks used `command -v`,
which finds executables as readily as functions,
and this test file is itself an executable named `nvm_print_color_legend`.
Whenever its own directory is on `PATH`, as it is under CI,
`command -v` kept resolving to the file
long after `nvm unload` had removed the function,
so the unload assertion could never pass there
and the "is it defined" guard could never fail.

`command -v` prints a bare name for a function
and a path for an executable,
in sh, bash, dash, zsh, and ksh alike,
so requiring the result to contain no slash
distinguishes the two.

Verified both ways round:
with the test's directory on `PATH`
the suite passes in all four shells,
and removing `nvm_print_color_legend` from `nvm unload`'s list
is still caught in all four.
2026-09-03 12:08:18 -07:00
..