nvm/test/fast/Unit tests
Oliver Henshaw 15eba7b7e6
[Fix] `nvm_strip_path`: Preserve leading/trailing colons
Path lists in environmental variables often give special meaning to
empty entries (e.g. in PATH or MANPATH). These are represented by
leading or trailing colons, or by doubled colons in the middle of the
list.

Adjust the awk invocation to correctly deal with trailing colons by
printing the separator before every field except the first, and then
printing the final separator that is read from the input - this will
either be a colon or the null string. This preserves leading and
trailing colons in all cases while not adding extra colons in the wrong
place.

Add test to confirm the correct behaviour.

Fixes #3144
2023-06-21 15:47:52 +01:00
..
mocks [Tests] update test mocks 2022-12-22 16:07:00 -08:00
nvm ls-remote [Tests] fix failing test 2021-12-17 13:21:29 -08:00
nvm set_colors [New] Added `set-colors` command. See details below: 2020-08-17 14:56:13 -07:00
nvm version-remote [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_add_iojs_prefix [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_alias Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
nvm_alias LTS-N [Fix] `nvm_alias`: ensure `lts/-1` returns the one before `lts/*` 2021-03-11 16:22:31 -05:00
nvm_alias_path [Docs] fix spelling 2018-03-06 04:38:01 +00:00
nvm_change_path [meta] update repo links to point to org 2019-04-24 16:08:34 -07:00
nvm_check_for_help [Fix] ensure `--help` is intercepted on any command 2020-08-04 16:32:19 -07:00
nvm_clang_version Add `nvm_clang_version` to ensure clang version > 3.5 2016-11-14 12:28:41 +08:00
nvm_command_info [Tests] `nvm_command_info`: make error output more helpful 2019-02-25 13:17:10 -08:00
nvm_compare_checksum [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_compute_checksum [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_curl_libz_support [New] Dynamically detect if curl supports `--compressed` 2017-03-23 16:51:20 +08:00
nvm_curl_use_compression [Fix] enable curl compression only on curl >=7.21.0 2017-06-10 15:25:26 +08:00
nvm_curl_version [Fix] enable curl compression only on curl >=7.21.0 2017-06-10 15:25:26 +08:00
nvm_die_on_prefix [Fix] `nvm_die_on_prefix`: filter prefixed env vars on name only, ignoring values 2020-11-28 15:16:35 +01:00
nvm_download [meta] use HEAD instead of master where possible 2022-12-23 12:53:40 -08:00
nvm_download_artifact [Tests] add unit tests for `nvm_download_artifact` 2023-04-06 09:23:33 -07:00
nvm_ensure_default_set [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_ensure_version_installed [Fix] `nvm install`: show proper version in `.nvmrc` install instructions 2022-03-22 18:58:18 +05:30
nvm_ensure_version_prefix [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_extract_tarball [Refactor] add `nvm_extract_tarball` to consolidate extraction logic 2021-12-19 02:58:18 +00:00
nvm_find_project_dir [Fix] fix directory traversal when workdir path is not readable 2023-04-08 17:24:41 +01:00
nvm_find_up [Fix] fix directory traversal when workdir path is not readable 2023-04-08 17:24:41 +01:00
nvm_format_version Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
nvm_get_arch [Fix] fix node download link for armv8l 2023-04-29 16:41:31 -07:00
nvm_get_artifact_compression [New] maybe support Windows with WSL, MSYS, Cygwin 2021-01-02 00:03:24 +01:00
nvm_get_checksum [Refactor] add `nvm_get_artifact_compression` 2021-01-02 00:03:24 +01:00
nvm_get_checksum_alg [New] add support for `$NVM_DIR/default-packages` file 2017-03-28 09:37:14 -07:00
nvm_get_checksum_binary [Refactor] add `nvm_get_checksum_binary`; use it in `nvm debug` 2020-07-31 22:13:21 -07:00
nvm_get_colors [New] Added `set-colors` command. See details below: 2020-08-17 14:56:13 -07:00
nvm_get_default_packages [Tests] Source nvm.sh before defining FILE 2020-03-19 12:13:29 +01:00
nvm_get_download_slug [Tests] `nvm_get_download_slug`: add unit tests 2021-12-02 23:33:20 -08:00
nvm_get_latest missing curl or wget [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_get_minor_version [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_get_mirror [New] add support for `$NVM_DIR/default-packages` file 2017-03-28 09:37:14 -07:00
nvm_has Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
nvm_has_non_aliased [Refactor] Add `nvm_has_non_aliased` 2017-03-20 16:57:26 +08:00
nvm_has_solaris_binary [Docs] fix spelling 2018-03-06 04:38:01 +00:00
nvm_has_system_iojs [Tests] update most mkdirs to use make_fake_{node,iojs} 2018-06-13 10:38:19 -07:00
nvm_has_system_node [Tests] update most mkdirs to use make_fake_{node,iojs} 2018-06-13 10:38:19 -07:00
nvm_install_binary_extract [New] maybe support Windows with WSL, MSYS, Cygwin 2021-01-02 00:03:24 +01:00
nvm_install_binary_nosource [New] `install`: add `-b` flag to skip building from source 2021-02-16 19:34:23 +05:30
nvm_install_latest_npm [New] `nvm install`: add `--latest-npm` option to automatically try to upgrade to the latest working version of `npm`. 2017-06-11 14:15:04 -07:00
nvm_install_no_progress_bar [New] Support `--no-progress` for `nvm install` 2017-03-10 01:07:16 +08:00
nvm_iojs_prefix [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_iojs_version_has_solaris_binary [Refactor] Rename solaris and iojs helper functions to be nvm_ prefixed 2020-05-08 16:08:27 -04:00
nvm_is_alias [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_is_iojs_version [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_is_merged_node_version [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_is_natural_num [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_is_valid_version [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_is_version_installed [Tests] Add unit tests for `nvm_is_version_installed` 2021-02-21 18:48:43 +01:00
nvm_ls_current [Tests] Fix `nvm_ls_current` fast test 2020-10-13 12:32:41 -04:00
nvm_ls_remote [Fix] `nvm ls-remote`: accept versions that end with a dot 2020-09-24 13:46:29 -07:00
nvm_ls_remote LTS aliases [Tests] update mocks 2021-03-11 13:06:41 -08:00
nvm_ls_remote nightly [Tests] `nvm ls-remote`: add test for overly-large tab file 2018-05-23 23:48:04 -04:00
nvm_ls_remote_iojs Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
nvm_make_alias [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_node_prefix [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_node_version_has_solaris_binary [Refactor] Rename solaris and iojs helper functions to be nvm_ prefixed 2020-05-08 16:08:27 -04:00
nvm_normalize_lts [Tests] fix failing test 2021-12-17 13:21:29 -08:00
nvm_num_version_groups Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
nvm_print_alias_path [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_print_color_code [Refactor] add `nvm_wrap_with_color_code`; allow no color code 2022-10-13 20:16:42 -07:00
nvm_print_default_alias [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_print_implicit_alias errors Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
nvm_print_implicit_alias success [Tests] update most mkdirs to use make_fake_{node,iojs} 2018-06-13 10:38:19 -07:00
nvm_print_npm_version [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_remote_version [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_remote_versions Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
nvm_stdout_is_terminal [Refactor] add `nvm_stdout_is_terminal` helper 2019-02-24 00:03:19 +01:00
nvm_strip_iojs_prefix [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_strip_path [Fix] `nvm_strip_path`: Preserve leading/trailing colons 2023-06-21 15:47:52 +01:00
nvm_supports_xz [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_tree_contains_path Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
nvm_use_if_needed [Fix] `nvm install -s`: npm detection 2017-03-27 15:00:50 -07:00
nvm_validate_implicit_alias Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
nvm_version [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
nvm_version_dir Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
nvm_version_greater Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
nvm_version_path Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
nvm_wrap_with_color_code [Refactor] add `nvm_wrap_with_color_code`; allow no color code 2022-10-13 20:16:42 -07:00