mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
fix: Fix plugin-test arg parsing (#1084)
This commit is contained in:
parent
4321980c33
commit
c911f2d431
@ -9,24 +9,26 @@ plugin_test_command() {
|
||||
local plugin_gitref="master"
|
||||
local tool_version
|
||||
local interpret_args_literally
|
||||
local skip_next_arg
|
||||
|
||||
for arg; do
|
||||
shift
|
||||
if [ -n "${interpret_args_literally}" ]; then
|
||||
if [ -n "${skip_next_arg}" ]; then
|
||||
skip_next_arg=
|
||||
elif [ -n "${interpret_args_literally}" ]; then
|
||||
set -- "$@" "${arg}"
|
||||
else
|
||||
case "${arg}" in
|
||||
--asdf-plugin-gitref)
|
||||
plugin_gitref="$2"
|
||||
shift 2
|
||||
plugin_gitref="$1"
|
||||
skip_next_arg=true
|
||||
;;
|
||||
--asdf-tool-version)
|
||||
tool_version="$2"
|
||||
shift 2
|
||||
tool_version="$1"
|
||||
skip_next_arg=true
|
||||
;;
|
||||
--)
|
||||
interpret_args_literally=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set -- "$@" "${arg}"
|
||||
|
20
test/fixtures/dummy_plugin/LICENSE
vendored
Normal file
20
test/fixtures/dummy_plugin/LICENSE
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Akash Manohar J
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -4,6 +4,7 @@ load test_helpers
|
||||
|
||||
setup() {
|
||||
setup_asdf_dir
|
||||
install_mock_plugin_repo "dummy"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
@ -21,3 +22,17 @@ teardown() {
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "FAILED: please provide a plugin name and url" ]
|
||||
}
|
||||
|
||||
@test "plugin_test_command works with no options provided" {
|
||||
run asdf plugin-test dummy "${BASE_DIR}/repo-dummy"
|
||||
echo "status = ${status}"
|
||||
echo "output = ${output}"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "plugin_test_command works with all options provided" {
|
||||
run asdf plugin-test dummy "${BASE_DIR}/repo-dummy" --asdf-tool-version 1.0.0 --asdf-plugin-gitref master
|
||||
echo "status = ${status}"
|
||||
echo "output = ${output}"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user