Files
nvm/test
Jordan Harband 17f12a1207 [Tests] nvm_print_color_legend: fix the fast suite on GNU userlands
The `nvm unload` assertion failed every `fast` job on Linux
while passing on macOS,
and its shape made the cause impossible to read off the failure.
`set -e` aborts the command substitution
when `nvm unload` returns non-zero,
which leaves an empty string
that the assertion then reports as
"unload left nvm_print_color_legend defined".
Run the unload with `set +e` inside the subshell
and report its exit status next to the lookup,
so a failing unload can no longer be misread
as a function that survived it.

The accompanying `sed: couldn't flush stdout: Broken pipe`
came from the `grep -q` pipelines:
`grep -q` exits at its first match
and hands SIGPIPE to the `sed` feeding it,
which BSD sed swallows and GNU sed reports.
Match whole lines with `case` against the already-captured string instead,
which needs no pipe at all,
and capture `nvm --help` before stripping it
rather than piping it through two processes into `grep -q`.

Test stderr is now empty in sh, bash, dash, and zsh.
2026-09-03 11:54:45 -07:00
..