mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-09-10 08:39:07 +00:00
[New] add lts/-1
etc, to point to an LTS line relative to "latest"
This commit is contained in:
5
test/fast/Unit tests/mocks/LTS_names.txt
Normal file
5
test/fast/Unit tests/mocks/LTS_names.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
erbium
|
||||
dubnium
|
||||
carbon
|
||||
boron
|
||||
argon
|
34
test/fast/Unit tests/nvm_alias LTS-N
Executable file
34
test/fast/Unit tests/nvm_alias LTS-N
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo "$@" ; cleanup ; exit 1; }
|
||||
|
||||
|
||||
cleanup() {
|
||||
unset -f nvm_download
|
||||
}
|
||||
|
||||
\. ../../../nvm.sh
|
||||
|
||||
set -ex
|
||||
|
||||
MOCKS_DIR="${PWD}/mocks"
|
||||
|
||||
# sample output at the time the test was written
|
||||
TAB_PATH="${MOCKS_DIR}/nodejs.org-dist-index.tab"
|
||||
nvm_download() {
|
||||
cat "${TAB_PATH}"
|
||||
}
|
||||
|
||||
nvm_ls_remote >/dev/null || die "nvm_ls_remote_failed?!"
|
||||
|
||||
LTS_NAMES_PATH="${MOCKS_DIR}/LTS_names.txt"
|
||||
|
||||
N=0
|
||||
while IFS= read -r LTS; do
|
||||
N=$(($N+1))
|
||||
EXPECTED="$(nvm_alias "lts/${LTS}")"
|
||||
ACTUAL="$(nvm_alias "lts/-${N}")"
|
||||
[ "${EXPECTED}" = "${ACTUAL}" ] || die "\`nvm_alias lts/-${N}\` was \`${ACTUAL}\`; expected \`${EXPECTED}\`"
|
||||
done < "${LTS_NAMES_PATH}"
|
||||
|
||||
cleanup
|
Reference in New Issue
Block a user