mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
fix: force lwrcase plugin name fix capitalization mismatch errs (#1400)
Co-authored-by: Trevor Brown <Stratus3D@users.noreply.github.com> Closes https://github.com/asdf-vm/asdf/issues/816
This commit is contained in:
parent
a4bf5824c7
commit
196a05b2dc
@ -56,9 +56,9 @@ plugin_add_command() {
|
||||
|
||||
local plugin_name=$1
|
||||
|
||||
local regex="^[[:alpha:][:digit:]_-]+$"
|
||||
local regex="^[[:lower:][:digit:]_-]+$"
|
||||
if ! printf "%s" "$plugin_name" | grep -q -E "$regex"; then
|
||||
display_error "$plugin_name is invalid. Name must match regex $regex"
|
||||
display_error "$plugin_name is invalid. Name may only contain lowercase letters, numbers, '_', and '-'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -11,13 +11,13 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "plugin_add command with plugin name matching all valid regex chars succeeds" {
|
||||
install_mock_plugin_repo "plugin_with-all-valid-CHARS-123"
|
||||
install_mock_plugin_repo "plugin_with-all-valid-chars-123"
|
||||
|
||||
run asdf plugin add "plugin_with-all-valid-CHARS-123" "${BASE_DIR}/repo-plugin_with-all-valid-CHARS-123"
|
||||
run asdf plugin add "plugin_with-all-valid-chars-123" "${BASE_DIR}/repo-plugin_with-all-valid-chars-123"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run asdf plugin list
|
||||
[ "$output" = "plugin_with-all-valid-CHARS-123" ]
|
||||
[ "$output" = "plugin_with-all-valid-chars-123" ]
|
||||
}
|
||||
|
||||
@test "plugin_add command with LANG=sv_SE.UTF-8 and plugin name matching all valid regex chars succeeds" {
|
||||
@ -36,16 +36,23 @@ teardown() {
|
||||
|
||||
LANG="$ORIGINAL_LANG"
|
||||
}
|
||||
@test "plugin_add command with plugin name not matching valid regex fails" {
|
||||
|
||||
@test "plugin_add command with plugin name not matching valid regex fails 1" {
|
||||
run asdf plugin add "invalid\$plugin\$name"
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "invalid\$plugin\$name is invalid. Name must match regex ^[[:alpha:][:digit:]_-]+$" ]
|
||||
[ "$output" = "invalid\$plugin\$name is invalid. Name may only contain lowercase letters, numbers, '_', and '-'" ]
|
||||
}
|
||||
|
||||
@test "plugin_add command with plugin name not matching valid regex fails again" {
|
||||
@test "plugin_add command with plugin name not matching valid regex fails 2" {
|
||||
run asdf plugin add "#invalid#plugin#name"
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "#invalid#plugin#name is invalid. Name must match regex ^[[:alpha:][:digit:]_-]+$" ]
|
||||
[ "$output" = "#invalid#plugin#name is invalid. Name may only contain lowercase letters, numbers, '_', and '-'" ]
|
||||
}
|
||||
|
||||
@test "plugin_add command with plugin name not matching valid regex fails 3" {
|
||||
run asdf plugin add "Ruby"
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "Ruby is invalid. Name may only contain lowercase letters, numbers, '_', and '-'" ]
|
||||
}
|
||||
|
||||
@test "plugin_add command with no URL specified adds a plugin using repo" {
|
||||
|
Loading…
Reference in New Issue
Block a user