Commit Graph

8 Commits

Author SHA1 Message Date
Jordan Harband
14d01c6877 [Tests] add try/try_err helpers; convert tests to use them
Add `try` and `try_err` helper functions to `test/common.sh` that capture stdout/stderr and exit code from a single invocation, eliminating duplicate command executions in tests.
Convert all existing tests that used the `OUTPUT`/`EXIT_CODE` double-invocation pattern to use the new helpers.
Also fixes a pre-existing bug in the `nvm_die_on_prefix` test where ASCII apostrophes were used instead of U+2019 to match nvm.sh output.
2026-03-13 15:26:07 -04:00
Jordan Harband
35212c1346 [Fix] nvm_has_colors: also check if stdout is a terminal 2026-01-27 10:31:07 -08:00
Jordan Harband
c451e7a4c8 [Tests] set $_ before sourcing nvm.sh in fast tests
nvm.sh uses `NVM_SCRIPT_SOURCE="$_"` to detect its source location.
Adding `: nvm.sh` before each source line ensures `$_` is set correctly, preventing breakage when the previous command (e.g., `set -ex`) overwrites it.
2026-01-26 21:41:57 -08:00
Peter Dave Hello
f7763c8ba9 [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
Qiangjun Ran
cadbbced20 [Tests] Replace all dots with backslash dots 2016-11-03 23:44:59 -07:00
Jordan Harband
2d50606a78 [Tests] flesh out nvm_print_default_alias tests 2016-04-30 00:38:49 -07:00
Jordan Harband
379d079c30 [Tests] Ensure color codes are stripped in alias tests. 2016-04-27 17:05:33 -07:00
Jordan Harband
4df2a7fca9 nvm alias: factor out alias printing logic to functions 2016-04-26 22:29:55 -07:00