[Fix] nvm_normalize_lts: error when an LTS name is not lowercase

Fixes #3417
This commit is contained in:
Jordan Harband 2024-09-04 13:54:41 -07:00
parent 9a28dbd394
commit 9fb9dec710
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
2 changed files with 7 additions and 0 deletions

4
nvm.sh
View File

@ -891,6 +891,10 @@ nvm_normalize_lts() {
fi
;;
*)
if [ "${LTS}" != "$(echo "${LTS}" | command tr '[:upper:]' '[:lower:]')" ]; then
nvm_err 'LTS names must be lowercase'
return 3
fi
nvm_echo "${LTS}"
;;
esac

View File

@ -16,6 +16,9 @@ ACTUAL="$(nvm_normalize_lts "lts/*")"
EXPECTED='lts/*'
[ "${ACTUAL}" = "${EXPECTED}" ] || die "expected >${EXPECTED}<, got >${ACTUAL}<"
if ACTUAL="$(nvm_normalize_lts lts/ARGON)"; then
die "expected failure, got >${ACTUAL}<"
fi
MOCKS_DIR="../Unit tests/mocks"
STAR="$(cat "$MOCKS_DIR/lts-star.txt")"