mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
chore: Fix ShellCheck errors in tests (#1449)
This commit is contained in:
parent
1ae7b683e1
commit
b5e981cf1d
@ -18,7 +18,7 @@ setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleaned_path() {
|
cleaned_path() {
|
||||||
echo $PATH | tr ':' '\n' | grep -v "asdf" | tr '\n' ' '
|
echo "$PATH" | tr ':' '\n' | grep -v "asdf" | tr '\n' ' '
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "exports ASDF_DIR" {
|
@test "exports ASDF_DIR" {
|
||||||
|
@ -7,7 +7,7 @@ setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleaned_path() {
|
cleaned_path() {
|
||||||
echo $PATH | tr ':' '\n' | grep -v "asdf" | tr '\n' ' '
|
echo "$PATH" | tr ':' '\n' | grep -v "asdf" | tr '\n' ' '
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "exports ASDF_DIR" {
|
@test "exports ASDF_DIR" {
|
||||||
|
@ -11,7 +11,7 @@ setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleaned_path() {
|
cleaned_path() {
|
||||||
echo $PATH | tr ':' '\n' | grep -v "asdf" | tr '\n' ':'
|
echo "$PATH" | tr ':' '\n' | grep -v "asdf" | tr '\n' ':'
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "exports ASDF_DIR" {
|
@test "exports ASDF_DIR" {
|
||||||
|
@ -8,7 +8,7 @@ source_asdf_sh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleaned_path() {
|
cleaned_path() {
|
||||||
echo $PATH | tr ':' '\n' | grep -v "asdf" | tr '\n' ':'
|
echo "$PATH" | tr ':' '\n' | grep -v "asdf" | tr '\n' ':'
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "exports ASDF_DIR" {
|
@test "exports ASDF_DIR" {
|
||||||
|
@ -9,8 +9,8 @@ setup() {
|
|||||||
install_dummy_version "1.2.0"
|
install_dummy_version "1.2.0"
|
||||||
install_dummy_version "nightly-2000-01-01"
|
install_dummy_version "nightly-2000-01-01"
|
||||||
|
|
||||||
PROJECT_DIR=$HOME/project
|
PROJECT_DIR="$HOME/project"
|
||||||
mkdir $PROJECT_DIR
|
mkdir -p "$PROJECT_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
@ -48,9 +48,9 @@ teardown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "current should derive from the legacy file if enabled" {
|
@test "current should derive from the legacy file if enabled" {
|
||||||
cd $PROJECT_DIR
|
cd "$PROJECT_DIR"
|
||||||
echo 'legacy_version_file = yes' >$HOME/.asdfrc
|
echo 'legacy_version_file = yes' >"$HOME/.asdfrc"
|
||||||
echo '1.2.0' >>$PROJECT_DIR/.dummy-version
|
echo '1.2.0' >>"$PROJECT_DIR/.dummy-version"
|
||||||
expected="dummy 1.2.0 $PROJECT_DIR/.dummy-version"
|
expected="dummy 1.2.0 $PROJECT_DIR/.dummy-version"
|
||||||
|
|
||||||
run asdf current "dummy"
|
run asdf current "dummy"
|
||||||
|
@ -3,15 +3,15 @@
|
|||||||
load test_helpers
|
load test_helpers
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
cd $BATS_TMPDIR
|
cd "$BATS_TMPDIR"
|
||||||
ASDF_CONFIG_FILE=$BATS_TMPDIR/asdfrc
|
ASDF_CONFIG_FILE="$BATS_TMPDIR/asdfrc"
|
||||||
cat >$ASDF_CONFIG_FILE <<-EOM
|
cat >"$ASDF_CONFIG_FILE" <<-EOM
|
||||||
key1 = value1
|
key1 = value1
|
||||||
legacy_version_file = yes
|
legacy_version_file = yes
|
||||||
EOM
|
EOM
|
||||||
|
|
||||||
ASDF_CONFIG_DEFAULT_FILE=$BATS_TMPDIR/asdfrc_defaults
|
ASDF_CONFIG_DEFAULT_FILE="$BATS_TMPDIR/asdfrc_defaults"
|
||||||
cat >$ASDF_CONFIG_DEFAULT_FILE <<-EOM
|
cat >"$ASDF_CONFIG_DEFAULT_FILE" <<-EOM
|
||||||
# i have a comment, it's ok
|
# i have a comment, it's ok
|
||||||
key2 = value2
|
key2 = value2
|
||||||
legacy_version_file = no
|
legacy_version_file = no
|
||||||
|
@ -9,8 +9,8 @@ setup() {
|
|||||||
run asdf install dummy 1.0
|
run asdf install dummy 1.0
|
||||||
run asdf install dummy 1.1
|
run asdf install dummy 1.1
|
||||||
|
|
||||||
PROJECT_DIR=$HOME/project
|
PROJECT_DIR="$HOME/project"
|
||||||
mkdir $PROJECT_DIR
|
mkdir -p "$PROJECT_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
|
@ -9,8 +9,8 @@ setup() {
|
|||||||
run asdf install dummy 1.0
|
run asdf install dummy 1.0
|
||||||
run asdf install dummy 1.1
|
run asdf install dummy 1.1
|
||||||
|
|
||||||
PROJECT_DIR=$HOME/project
|
PROJECT_DIR="$HOME/project"
|
||||||
mkdir $PROJECT_DIR
|
mkdir -p "$PROJECT_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
|
@ -8,8 +8,8 @@ setup() {
|
|||||||
install_dummy_plugin
|
install_dummy_plugin
|
||||||
install_dummy_broken_plugin
|
install_dummy_broken_plugin
|
||||||
|
|
||||||
PROJECT_DIR=$HOME/project
|
PROJECT_DIR="$HOME/project"
|
||||||
mkdir $PROJECT_DIR
|
mkdir -p "$PROJECT_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
@ -221,9 +221,9 @@ EOM
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "install command without arguments installs versions from legacy files" {
|
@test "install command without arguments installs versions from legacy files" {
|
||||||
echo 'legacy_version_file = yes' >$HOME/.asdfrc
|
echo 'legacy_version_file = yes' >"$HOME/.asdfrc"
|
||||||
echo '1.2.0' >>$PROJECT_DIR/.dummy-version
|
echo '1.2.0' >>"$PROJECT_DIR/.dummy-version"
|
||||||
cd $PROJECT_DIR
|
cd "$PROJECT_DIR"
|
||||||
run asdf install
|
run asdf install
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ -z "$output" ]
|
[ -z "$output" ]
|
||||||
@ -231,8 +231,8 @@ EOM
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "install command without arguments installs versions from legacy files in parent directories" {
|
@test "install command without arguments installs versions from legacy files in parent directories" {
|
||||||
echo 'legacy_version_file = yes' >$HOME/.asdfrc
|
echo 'legacy_version_file = yes' >"$HOME/.asdfrc"
|
||||||
echo '1.2.0' >>$PROJECT_DIR/.dummy-version
|
echo '1.2.0' >>"$PROJECT_DIR/.dummy-version"
|
||||||
|
|
||||||
mkdir -p $PROJECT_DIR/child
|
mkdir -p $PROJECT_DIR/child
|
||||||
cd $PROJECT_DIR/child
|
cd $PROJECT_DIR/child
|
||||||
@ -270,7 +270,7 @@ EOM
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "install_command keeps the download directory when always_keep_download setting is true" {
|
@test "install_command keeps the download directory when always_keep_download setting is true" {
|
||||||
echo 'always_keep_download = yes' >$HOME/.asdfrc
|
echo 'always_keep_download = yes' >"$HOME/.asdfrc"
|
||||||
run asdf install dummy 1.1.0
|
run asdf install dummy 1.1.0
|
||||||
echo $output
|
echo $output
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
@ -7,8 +7,8 @@ setup() {
|
|||||||
install_dummy_plugin
|
install_dummy_plugin
|
||||||
install_dummy_broken_plugin
|
install_dummy_broken_plugin
|
||||||
|
|
||||||
PROJECT_DIR=$HOME/project
|
PROJECT_DIR="$HOME/project"
|
||||||
mkdir $PROJECT_DIR
|
mkdir -p "$PROJECT_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
|
@ -64,8 +64,8 @@ teardown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "plugin_add command with no URL specified adds a plugin when short name repository is enabled" {
|
@test "plugin_add command with no URL specified adds a plugin when short name repository is enabled" {
|
||||||
export ASDF_CONFIG_DEFAULT_FILE=$HOME/.asdfrc
|
export ASDF_CONFIG_DEFAULT_FILE="$HOME/.asdfrc"
|
||||||
echo "disable_plugin_short_name_repository=no" >$ASDF_CONFIG_DEFAULT_FILE
|
echo "disable_plugin_short_name_repository=no" >"$ASDF_CONFIG_DEFAULT_FILE"
|
||||||
|
|
||||||
run asdf plugin add "elixir"
|
run asdf plugin add "elixir"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
@ -76,8 +76,8 @@ teardown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "plugin_add command with no URL specified fails to add a plugin when disabled" {
|
@test "plugin_add command with no URL specified fails to add a plugin when disabled" {
|
||||||
export ASDF_CONFIG_DEFAULT_FILE=$HOME/.asdfrc
|
export ASDF_CONFIG_DEFAULT_FILE="$HOME/.asdfrc"
|
||||||
echo "disable_plugin_short_name_repository=yes" >$ASDF_CONFIG_DEFAULT_FILE
|
echo "disable_plugin_short_name_repository=yes" >"$ASDF_CONFIG_DEFAULT_FILE"
|
||||||
local expected="Short-name plugin repository is disabled"
|
local expected="Short-name plugin repository is disabled"
|
||||||
|
|
||||||
run asdf plugin add "elixir"
|
run asdf plugin add "elixir"
|
||||||
|
@ -13,8 +13,8 @@ teardown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "plugin_list_all should exit before syncing the plugin repo if disabled" {
|
@test "plugin_list_all should exit before syncing the plugin repo if disabled" {
|
||||||
export ASDF_CONFIG_DEFAULT_FILE=$HOME/.asdfrc
|
export ASDF_CONFIG_DEFAULT_FILE="$HOME/.asdfrc"
|
||||||
echo 'disable_plugin_short_name_repository=yes' >$ASDF_CONFIG_DEFAULT_FILE
|
echo 'disable_plugin_short_name_repository=yes' >"$ASDF_CONFIG_DEFAULT_FILE"
|
||||||
local expected="Short-name plugin repository is disabled"
|
local expected="Short-name plugin repository is disabled"
|
||||||
|
|
||||||
run asdf plugin list all
|
run asdf plugin list all
|
||||||
@ -23,8 +23,8 @@ teardown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "plugin_list_all should sync repo when check_duration set to 0" {
|
@test "plugin_list_all should sync repo when check_duration set to 0" {
|
||||||
export ASDF_CONFIG_DEFAULT_FILE=$HOME/.asdfrc
|
export ASDF_CONFIG_DEFAULT_FILE="$HOME/.asdfrc"
|
||||||
echo 'plugin_repository_last_check_duration = 0' >$ASDF_CONFIG_DEFAULT_FILE
|
echo 'plugin_repository_last_check_duration = 0' >"$ASDF_CONFIG_DEFAULT_FILE"
|
||||||
local expected_plugin_repo_sync="updating plugin repository..."
|
local expected_plugin_repo_sync="updating plugin repository..."
|
||||||
local expected_plugins_list="\
|
local expected_plugins_list="\
|
||||||
bar http://example.com/bar
|
bar http://example.com/bar
|
||||||
@ -38,8 +38,8 @@ foo http://example.com/foo"
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "plugin_list_all no immediate repo sync expected because check_duration is greater than 0" {
|
@test "plugin_list_all no immediate repo sync expected because check_duration is greater than 0" {
|
||||||
export ASDF_CONFIG_DEFAULT_FILE=$HOME/.asdfrc
|
export ASDF_CONFIG_DEFAULT_FILE="$HOME/.asdfrc"
|
||||||
echo 'plugin_repository_last_check_duration = 10' >$ASDF_CONFIG_DEFAULT_FILE
|
echo 'plugin_repository_last_check_duration = 10' >"$ASDF_CONFIG_DEFAULT_FILE"
|
||||||
local expected="\
|
local expected="\
|
||||||
bar http://example.com/bar
|
bar http://example.com/bar
|
||||||
dummy *http://example.com/dummy
|
dummy *http://example.com/dummy
|
||||||
@ -51,8 +51,8 @@ foo http://example.com/foo"
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "plugin_list_all skips repo sync because check_duration is set to never" {
|
@test "plugin_list_all skips repo sync because check_duration is set to never" {
|
||||||
export ASDF_CONFIG_DEFAULT_FILE=$HOME/.asdfrc
|
export ASDF_CONFIG_DEFAULT_FILE="$HOME/.asdfrc"
|
||||||
echo 'plugin_repository_last_check_duration = never' >$ASDF_CONFIG_DEFAULT_FILE
|
echo 'plugin_repository_last_check_duration = never' >"$ASDF_CONFIG_DEFAULT_FILE"
|
||||||
local expected="\
|
local expected="\
|
||||||
bar http://example.com/bar
|
bar http://example.com/bar
|
||||||
dummy *http://example.com/dummy
|
dummy *http://example.com/dummy
|
||||||
|
@ -6,9 +6,9 @@ setup() {
|
|||||||
setup_asdf_dir
|
setup_asdf_dir
|
||||||
install_dummy_plugin
|
install_dummy_plugin
|
||||||
|
|
||||||
PROJECT_DIR=$HOME/project
|
PROJECT_DIR="$HOME/project"
|
||||||
mkdir -p $PROJECT_DIR
|
mkdir -p "$PROJECT_DIR"
|
||||||
cd $PROJECT_DIR
|
cd "$PROJECT_DIR"
|
||||||
|
|
||||||
# asdf lib needed to run generated shims
|
# asdf lib needed to run generated shims
|
||||||
cp -rf $BATS_TEST_DIRNAME/../{bin,lib} $ASDF_DIR/
|
cp -rf $BATS_TEST_DIRNAME/../{bin,lib} $ASDF_DIR/
|
||||||
@ -37,20 +37,20 @@ teardown() {
|
|||||||
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
||||||
run asdf install
|
run asdf install
|
||||||
|
|
||||||
echo "export FOO=bar" >$ASDF_DIR/plugins/dummy/bin/exec-env
|
echo "export FOO=bar" >"$ASDF_DIR/plugins/dummy/bin/exec-env"
|
||||||
chmod +x $ASDF_DIR/plugins/dummy/bin/exec-env
|
chmod +x "$ASDF_DIR/plugins/dummy/bin/exec-env"
|
||||||
|
|
||||||
run asdf env dummy
|
run asdf env dummy
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
echo $output | grep 'FOO=bar'
|
echo "$output" | grep 'FOO=bar'
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "asdf env should ignore plugin custom environment on system version" {
|
@test "asdf env should ignore plugin custom environment on system version" {
|
||||||
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
||||||
run asdf install
|
run asdf install
|
||||||
|
|
||||||
echo "export FOO=bar" >$ASDF_DIR/plugins/dummy/bin/exec-env
|
echo "export FOO=bar" >"$ASDF_DIR/plugins/dummy/bin/exec-env"
|
||||||
chmod +x $ASDF_DIR/plugins/dummy/bin/exec-env
|
chmod +x "$ASDF_DIR/plugins/dummy/bin/exec-env"
|
||||||
|
|
||||||
echo "dummy system" >$PROJECT_DIR/.tool-versions
|
echo "dummy system" >$PROJECT_DIR/.tool-versions
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@ setup() {
|
|||||||
setup_asdf_dir
|
setup_asdf_dir
|
||||||
install_dummy_plugin
|
install_dummy_plugin
|
||||||
|
|
||||||
PROJECT_DIR=$HOME/project
|
PROJECT_DIR="$HOME/project"
|
||||||
mkdir -p $PROJECT_DIR
|
mkdir -p "$PROJECT_DIR"
|
||||||
cd $PROJECT_DIR
|
cd "$PROJECT_DIR"
|
||||||
|
|
||||||
# asdf lib needed to run generated shims
|
# asdf lib needed to run generated shims
|
||||||
cp -rf $BATS_TEST_DIRNAME/../{bin,lib} $ASDF_DIR/
|
cp -rf $BATS_TEST_DIRNAME/../{bin,lib} $ASDF_DIR/
|
||||||
@ -201,18 +201,18 @@ teardown() {
|
|||||||
echo "echo System" >$PROJECT_DIR/foo/dummy
|
echo "echo System" >$PROJECT_DIR/foo/dummy
|
||||||
chmod +x $PROJECT_DIR/foo/dummy
|
chmod +x $PROJECT_DIR/foo/dummy
|
||||||
|
|
||||||
run env PATH=$PATH:$PROJECT_DIR/foo $ASDF_DIR/shims/dummy hello
|
run env "PATH=$PATH:$PROJECT_DIR/foo" "$ASDF_DIR/shims/dummy" hello
|
||||||
[ "$output" = "System" ]
|
[ "$output" = "System" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "shim exec should use path executable when specified version path:<path>" {
|
@test "shim exec should use path executable when specified version path:<path>" {
|
||||||
run asdf install dummy 1.0
|
run asdf install dummy 1.0
|
||||||
|
|
||||||
CUSTOM_DUMMY_PATH=$PROJECT_DIR/foo
|
CUSTOM_DUMMY_PATH="$PROJECT_DIR/foo"
|
||||||
CUSTOM_DUMMY_BIN_PATH=$CUSTOM_DUMMY_PATH/bin
|
CUSTOM_DUMMY_BIN_PATH="$CUSTOM_DUMMY_PATH/bin"
|
||||||
mkdir -p $CUSTOM_DUMMY_BIN_PATH
|
mkdir -p "$CUSTOM_DUMMY_BIN_PATH"
|
||||||
echo "echo System" >$CUSTOM_DUMMY_BIN_PATH/dummy
|
echo "echo System" >"$CUSTOM_DUMMY_BIN_PATH/dummy"
|
||||||
chmod +x $CUSTOM_DUMMY_BIN_PATH/dummy
|
chmod +x "$CUSTOM_DUMMY_BIN_PATH/dummy"
|
||||||
|
|
||||||
echo "dummy path:$CUSTOM_DUMMY_PATH" >$PROJECT_DIR/.tool-versions
|
echo "dummy path:$CUSTOM_DUMMY_PATH" >$PROJECT_DIR/.tool-versions
|
||||||
|
|
||||||
@ -230,16 +230,16 @@ teardown() {
|
|||||||
echo "echo System" >$PROJECT_DIR/foo/dummy
|
echo "echo System" >$PROJECT_DIR/foo/dummy
|
||||||
chmod +x $PROJECT_DIR/foo/dummy
|
chmod +x $PROJECT_DIR/foo/dummy
|
||||||
|
|
||||||
run env PATH=$PATH:$PROJECT_DIR/foo $ASDF_DIR/shims/dummy hello
|
run env "PATH=$PATH:$PROJECT_DIR/foo" "$ASDF_DIR/shims/dummy" hello
|
||||||
[ "$output" = "System" ]
|
[ "$output" = "System" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "shim exec should use custom exec-env for tool" {
|
@test "shim exec should use custom exec-env for tool" {
|
||||||
run asdf install dummy 2.0.0
|
run asdf install dummy 2.0.0
|
||||||
echo "export FOO=sourced" >$ASDF_DIR/plugins/dummy/bin/exec-env
|
echo "export FOO=sourced" >"$ASDF_DIR/plugins/dummy/bin/exec-env"
|
||||||
mkdir $ASDF_DIR/plugins/dummy/shims
|
mkdir "$ASDF_DIR/plugins/dummy/shims"
|
||||||
echo 'echo $FOO custom' >$ASDF_DIR/plugins/dummy/shims/foo
|
echo 'echo $FOO custom' >"$ASDF_DIR/plugins/dummy/shims/foo"
|
||||||
chmod +x $ASDF_DIR/plugins/dummy/shims/foo
|
chmod +x "$ASDF_DIR/plugins/dummy/shims/foo"
|
||||||
run asdf reshim dummy 2.0.0
|
run asdf reshim dummy 2.0.0
|
||||||
|
|
||||||
echo "dummy 2.0.0" >$PROJECT_DIR/.tool-versions
|
echo "dummy 2.0.0" >$PROJECT_DIR/.tool-versions
|
||||||
@ -249,10 +249,10 @@ teardown() {
|
|||||||
|
|
||||||
@test "shim exec with custom exec-env using ASDF_INSTALL_PATH" {
|
@test "shim exec with custom exec-env using ASDF_INSTALL_PATH" {
|
||||||
run asdf install dummy 2.0.0
|
run asdf install dummy 2.0.0
|
||||||
echo 'export FOO=$ASDF_INSTALL_PATH/foo' >$ASDF_DIR/plugins/dummy/bin/exec-env
|
echo 'export FOO=$ASDF_INSTALL_PATH/foo' >"$ASDF_DIR/plugins/dummy/bin/exec-env"
|
||||||
mkdir $ASDF_DIR/plugins/dummy/shims
|
mkdir "$ASDF_DIR/plugins/dummy/shims"
|
||||||
echo 'echo $FOO custom' >$ASDF_DIR/plugins/dummy/shims/foo
|
echo 'echo $FOO custom' >"$ASDF_DIR/plugins/dummy/shims/foo"
|
||||||
chmod +x $ASDF_DIR/plugins/dummy/shims/foo
|
chmod +x "$ASDF_DIR/plugins/dummy/shims/foo"
|
||||||
run asdf reshim dummy 2.0.0
|
run asdf reshim dummy 2.0.0
|
||||||
|
|
||||||
echo "dummy 2.0.0" >$PROJECT_DIR/.tool-versions
|
echo "dummy 2.0.0" >$PROJECT_DIR/.tool-versions
|
||||||
@ -262,10 +262,10 @@ teardown() {
|
|||||||
|
|
||||||
@test "shim exec doest not use custom exec-env for system version" {
|
@test "shim exec doest not use custom exec-env for system version" {
|
||||||
run asdf install dummy 2.0.0
|
run asdf install dummy 2.0.0
|
||||||
echo "export FOO=sourced" >$ASDF_DIR/plugins/dummy/bin/exec-env
|
echo "export FOO=sourced" >"$ASDF_DIR/plugins/dummy/bin/exec-env"
|
||||||
mkdir $ASDF_DIR/plugins/dummy/shims
|
mkdir "$ASDF_DIR/plugins/dummy/shims"
|
||||||
echo 'echo $FOO custom' >$ASDF_DIR/plugins/dummy/shims/foo
|
echo 'echo $FOO custom' >"$ASDF_DIR/plugins/dummy/shims/foo"
|
||||||
chmod +x $ASDF_DIR/plugins/dummy/shims/foo
|
chmod +x "$ASDF_DIR/plugins/dummy/shims/foo"
|
||||||
run asdf reshim dummy 2.0.0
|
run asdf reshim dummy 2.0.0
|
||||||
|
|
||||||
echo "dummy system" >$PROJECT_DIR/.tool-versions
|
echo "dummy system" >$PROJECT_DIR/.tool-versions
|
||||||
@ -274,7 +274,7 @@ teardown() {
|
|||||||
echo 'echo x$FOO System' >$PROJECT_DIR/sys/foo
|
echo 'echo x$FOO System' >$PROJECT_DIR/sys/foo
|
||||||
chmod +x $PROJECT_DIR/sys/foo
|
chmod +x $PROJECT_DIR/sys/foo
|
||||||
|
|
||||||
run env PATH=$PATH:$PROJECT_DIR/sys $ASDF_DIR/shims/foo
|
run env "PATH=$PATH:$PROJECT_DIR/sys" "$ASDF_DIR/shims/foo"
|
||||||
[ "$output" = "x System" ]
|
[ "$output" = "x System" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,16 +329,16 @@ teardown() {
|
|||||||
echo 'which dummy' >$PROJECT_DIR/sys/dummy
|
echo 'which dummy' >$PROJECT_DIR/sys/dummy
|
||||||
chmod +x $PROJECT_DIR/sys/dummy
|
chmod +x $PROJECT_DIR/sys/dummy
|
||||||
|
|
||||||
run env PATH=$PATH:$PROJECT_DIR/sys $ASDF_DIR/shims/dummy
|
run env "PATH=$PATH:$PROJECT_DIR/sys" "$ASDF_DIR/shims/dummy"
|
||||||
echo $status $output
|
echo "$status $output"
|
||||||
[ "$output" = "$ASDF_DIR/shims/dummy" ]
|
[ "$output" = "$ASDF_DIR/shims/dummy" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "shim exec can take version from legacy file if configured" {
|
@test "shim exec can take version from legacy file if configured" {
|
||||||
run asdf install dummy 2.0.0
|
run asdf install dummy 2.0.0
|
||||||
|
|
||||||
echo "legacy_version_file = yes" >$HOME/.asdfrc
|
echo "legacy_version_file = yes" >"$HOME/.asdfrc"
|
||||||
echo "2.0.0" >$PROJECT_DIR/.dummy-version
|
echo "2.0.0" >"$PROJECT_DIR/.dummy-version"
|
||||||
|
|
||||||
run $ASDF_DIR/shims/dummy world hello
|
run $ASDF_DIR/shims/dummy world hello
|
||||||
[ "$output" = "This is Dummy 2.0.0! hello world" ]
|
[ "$output" = "This is Dummy 2.0.0! hello world" ]
|
||||||
@ -346,7 +346,7 @@ teardown() {
|
|||||||
|
|
||||||
@test "shim exec can take version from environment variable" {
|
@test "shim exec can take version from environment variable" {
|
||||||
run asdf install dummy 2.0.0
|
run asdf install dummy 2.0.0
|
||||||
run env ASDF_DUMMY_VERSION=2.0.0 $ASDF_DIR/shims/dummy world hello
|
run env ASDF_DUMMY_VERSION=2.0.0 "$ASDF_DIR/shims/dummy" world hello
|
||||||
[ "$output" = "This is Dummy 2.0.0! hello world" ]
|
[ "$output" = "This is Dummy 2.0.0! hello world" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ EOM
|
|||||||
pre_dummy_dummy = pre $1 no $plugin_name $2
|
pre_dummy_dummy = pre $1 no $plugin_name $2
|
||||||
EOM
|
EOM
|
||||||
|
|
||||||
run env PATH=$PATH:$HOME/hook $ASDF_DIR/shims/dummy hello world
|
run env PATH="$PATH:$HOME/hook" "$ASDF_DIR/shims/dummy" hello world
|
||||||
[ "$output" = "hello no dummy world" ]
|
[ "$output" = "hello no dummy world" ]
|
||||||
[ "$status" -eq 1 ]
|
[ "$status" -eq 1 ]
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,9 @@ setup() {
|
|||||||
setup_asdf_dir
|
setup_asdf_dir
|
||||||
install_dummy_plugin
|
install_dummy_plugin
|
||||||
|
|
||||||
PROJECT_DIR=$HOME/project
|
PROJECT_DIR="$HOME/project"
|
||||||
mkdir -p $PROJECT_DIR
|
mkdir -p "$PROJECT_DIR"
|
||||||
cd $PROJECT_DIR
|
cd "$PROJECT_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
|
@ -6,8 +6,8 @@ setup() {
|
|||||||
setup_asdf_dir
|
setup_asdf_dir
|
||||||
install_dummy_plugin
|
install_dummy_plugin
|
||||||
|
|
||||||
PROJECT_DIR=$HOME/project
|
PROJECT_DIR="$HOME/project"
|
||||||
mkdir $PROJECT_DIR
|
mkdir -p "$PROJECT_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
|
@ -4,8 +4,8 @@ load test_helpers
|
|||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
BASE_DIR=$(mktemp -dt asdf.XXXX)
|
BASE_DIR=$(mktemp -dt asdf.XXXX)
|
||||||
HOME=$BASE_DIR/home
|
HOME="$BASE_DIR/home"
|
||||||
ASDF_DIR=$HOME/.asdf
|
ASDF_DIR="$HOME/.asdf"
|
||||||
git clone -o local "$(dirname "$BATS_TEST_DIRNAME")" "$ASDF_DIR"
|
git clone -o local "$(dirname "$BATS_TEST_DIRNAME")" "$ASDF_DIR"
|
||||||
git --git-dir "$ASDF_DIR/.git" remote add origin https://github.com/asdf-vm/asdf.git
|
git --git-dir "$ASDF_DIR/.git" remote add origin https://github.com/asdf-vm/asdf.git
|
||||||
mkdir -p "$ASDF_DIR/plugins"
|
mkdir -p "$ASDF_DIR/plugins"
|
||||||
@ -15,11 +15,11 @@ setup() {
|
|||||||
ASDF_BIN="$ASDF_DIR/bin"
|
ASDF_BIN="$ASDF_DIR/bin"
|
||||||
|
|
||||||
# shellcheck disable=SC2031
|
# shellcheck disable=SC2031
|
||||||
PATH=$ASDF_BIN:$ASDF_DIR/shims:$PATH
|
PATH="$ASDF_BIN:$ASDF_DIR/shims:$PATH"
|
||||||
install_dummy_plugin
|
install_dummy_plugin
|
||||||
|
|
||||||
PROJECT_DIR=$HOME/project
|
PROJECT_DIR="$HOME/project"
|
||||||
mkdir $PROJECT_DIR
|
mkdir -p "$PROJECT_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
@ -49,8 +49,8 @@ teardown() {
|
|||||||
local tag=
|
local tag=
|
||||||
tag=$(git tag | tail -1)
|
tag=$(git tag | tail -1)
|
||||||
if [ -n "$tag" ]; then
|
if [ -n "$tag" ]; then
|
||||||
export ASDF_CONFIG_DEFAULT_FILE=$BATS_TMPDIR/asdfrc_defaults
|
export ASDF_CONFIG_DEFAULT_FILE="$BATS_TMPDIR/asdfrc_defaults"
|
||||||
echo "use_release_candidates = yes" >$ASDF_CONFIG_DEFAULT_FILE
|
echo "use_release_candidates = yes" >"$ASDF_CONFIG_DEFAULT_FILE"
|
||||||
run asdf update
|
run asdf update
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
cd "$ASDF_DIR"
|
cd "$ASDF_DIR"
|
||||||
|
@ -8,8 +8,8 @@ setup() {
|
|||||||
install_dummy_version "0.1.0"
|
install_dummy_version "0.1.0"
|
||||||
install_dummy_version "0.2.0"
|
install_dummy_version "0.2.0"
|
||||||
|
|
||||||
PROJECT_DIR=$HOME/project
|
PROJECT_DIR="$HOME/project"
|
||||||
mkdir -p $PROJECT_DIR
|
mkdir -p "$PROJECT_DIR"
|
||||||
|
|
||||||
cd $HOME
|
cd $HOME
|
||||||
}
|
}
|
||||||
@ -150,9 +150,9 @@ teardown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "find_versions should return the legacy file if supported" {
|
@test "find_versions should return the legacy file if supported" {
|
||||||
echo "legacy_version_file = yes" >$HOME/.asdfrc
|
echo "legacy_version_file = yes" >"$HOME/.asdfrc"
|
||||||
echo "dummy 0.1.0" >$HOME/.tool-versions
|
echo "dummy 0.1.0" >"$HOME/.tool-versions"
|
||||||
echo "0.2.0" >$PROJECT_DIR/.dummy-version
|
echo "0.2.0" >"$PROJECT_DIR/.dummy-version"
|
||||||
|
|
||||||
run find_versions "dummy" $PROJECT_DIR
|
run find_versions "dummy" $PROJECT_DIR
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
@ -169,10 +169,10 @@ teardown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "find_versions should return .tool-versions if unsupported" {
|
@test "find_versions should return .tool-versions if unsupported" {
|
||||||
echo "dummy 0.1.0" >$HOME/.tool-versions
|
echo "dummy 0.1.0" >"$HOME/.tool-versions"
|
||||||
echo "0.2.0" >$PROJECT_DIR/.dummy-version
|
echo "0.2.0" >"$PROJECT_DIR/.dummy-version"
|
||||||
echo "legacy_version_file = yes" >$HOME/.asdfrc
|
echo "legacy_version_file = yes" >"$HOME/.asdfrc"
|
||||||
rm $ASDF_DIR/plugins/dummy/bin/list-legacy-filenames
|
rm "$ASDF_DIR/plugins/dummy/bin/list-legacy-filenames"
|
||||||
|
|
||||||
run find_versions "dummy" $PROJECT_DIR
|
run find_versions "dummy" $PROJECT_DIR
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
@ -229,9 +229,9 @@ teardown() {
|
|||||||
|
|
||||||
@test "find_versions should check \$HOME legacy files before \$ASDF_DEFAULT_TOOL_VERSIONS_FILENAME" {
|
@test "find_versions should check \$HOME legacy files before \$ASDF_DEFAULT_TOOL_VERSIONS_FILENAME" {
|
||||||
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME="$PROJECT_DIR/global-tool-versions"
|
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME="$PROJECT_DIR/global-tool-versions"
|
||||||
echo "dummy 0.2.0" >$ASDF_DEFAULT_TOOL_VERSIONS_FILENAME
|
echo "dummy 0.2.0" >"$ASDF_DEFAULT_TOOL_VERSIONS_FILENAME"
|
||||||
echo "dummy 0.1.0" >$HOME/.dummy-version
|
echo "dummy 0.1.0" >"$HOME/.dummy-version"
|
||||||
echo "legacy_version_file = yes" >$HOME/.asdfrc
|
echo "legacy_version_file = yes" >"$HOME/.asdfrc"
|
||||||
|
|
||||||
run find_versions "dummy" $PROJECT_DIR
|
run find_versions "dummy" $PROJECT_DIR
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
@ -307,11 +307,11 @@ teardown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "get_executable_path for non system version should return relative path from plugin" {
|
@test "get_executable_path for non system version should return relative path from plugin" {
|
||||||
mkdir -p $ASDF_DIR/plugins/foo
|
mkdir -p "$ASDF_DIR/plugins/foo"
|
||||||
mkdir -p $ASDF_DIR/installs/foo/1.0.0/bin
|
mkdir -p "$ASDF_DIR/installs/foo/1.0.0/bin"
|
||||||
executable_path=$ASDF_DIR/installs/foo/1.0.0/bin/dummy
|
executable_path="$ASDF_DIR/installs/foo/1.0.0/bin/dummy"
|
||||||
touch $executable_path
|
touch "$executable_path"
|
||||||
chmod +x $executable_path
|
chmod +x "$executable_path"
|
||||||
|
|
||||||
run get_executable_path "foo" "1.0.0" "bin/dummy"
|
run get_executable_path "foo" "1.0.0" "bin/dummy"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
@ -319,11 +319,11 @@ teardown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "get_executable_path for ref:version installed version should resolve to ref-version" {
|
@test "get_executable_path for ref:version installed version should resolve to ref-version" {
|
||||||
mkdir -p $ASDF_DIR/plugins/foo
|
mkdir -p "$ASDF_DIR/plugins/foo"
|
||||||
mkdir -p $ASDF_DIR/installs/foo/ref-master/bin
|
mkdir -p "$ASDF_DIR/installs/foo/ref-master/bin"
|
||||||
executable_path=$ASDF_DIR/installs/foo/ref-master/bin/dummy
|
executable_path="$ASDF_DIR/installs/foo/ref-master/bin/dummy"
|
||||||
touch $executable_path
|
touch "$executable_path"
|
||||||
chmod +x $executable_path
|
chmod +x "$executable_path"
|
||||||
|
|
||||||
run get_executable_path "foo" "ref:master" "bin/dummy"
|
run get_executable_path "foo" "ref:master" "bin/dummy"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
@ -15,11 +15,11 @@ setup() {
|
|||||||
install_dummy_legacy_version "2.0.0"
|
install_dummy_legacy_version "2.0.0"
|
||||||
install_dummy_legacy_version "5.1.0"
|
install_dummy_legacy_version "5.1.0"
|
||||||
|
|
||||||
PROJECT_DIR=$HOME/project
|
PROJECT_DIR="$HOME/project"
|
||||||
mkdir -p $PROJECT_DIR
|
mkdir -p "$PROJECT_DIR"
|
||||||
|
|
||||||
CHILD_DIR=$PROJECT_DIR/child-dir
|
CHILD_DIR="$PROJECT_DIR/child-dir"
|
||||||
mkdir -p $CHILD_DIR
|
mkdir -p "$CHILD_DIR"
|
||||||
|
|
||||||
cd $PROJECT_DIR
|
cd $PROJECT_DIR
|
||||||
|
|
||||||
|
@ -8,9 +8,9 @@ setup() {
|
|||||||
run asdf install dummy 1.0
|
run asdf install dummy 1.0
|
||||||
run asdf install dummy 1.1
|
run asdf install dummy 1.1
|
||||||
|
|
||||||
PROJECT_DIR=$HOME/project
|
PROJECT_DIR="$HOME/project"
|
||||||
mkdir $PROJECT_DIR
|
mkdir -p "$PROJECT_DIR"
|
||||||
echo 'dummy 1.0' >>$PROJECT_DIR/.tool-versions
|
echo 'dummy 1.0' >>"$PROJECT_DIR/.tool-versions"
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
@ -53,7 +53,7 @@ teardown() {
|
|||||||
touch $PROJECT_DIR/sys/dummy
|
touch $PROJECT_DIR/sys/dummy
|
||||||
chmod +x $PROJECT_DIR/sys/dummy
|
chmod +x $PROJECT_DIR/sys/dummy
|
||||||
|
|
||||||
run env PATH=$PATH:$PROJECT_DIR/sys asdf which "dummy"
|
run env "PATH=$PATH:$PROJECT_DIR/sys" asdf which "dummy"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "$PROJECT_DIR/sys/dummy" ]
|
[ "$output" = "$PROJECT_DIR/sys/dummy" ]
|
||||||
}
|
}
|
||||||
@ -87,10 +87,10 @@ teardown() {
|
|||||||
@test "which should return the path set by the legacy file" {
|
@test "which should return the path set by the legacy file" {
|
||||||
cd $PROJECT_DIR
|
cd $PROJECT_DIR
|
||||||
|
|
||||||
echo 'dummy 1.0' >>$HOME/.tool-versions
|
echo 'dummy 1.0' >>"$HOME/.tool-versions"
|
||||||
echo '1.1' >>$PROJECT_DIR/.dummy-version
|
echo '1.1' >>"$PROJECT_DIR/.dummy-version"
|
||||||
rm $PROJECT_DIR/.tool-versions
|
rm "$PROJECT_DIR/.tool-versions"
|
||||||
echo 'legacy_version_file = yes' >$HOME/.asdfrc
|
echo 'legacy_version_file = yes' >"$HOME/.asdfrc"
|
||||||
|
|
||||||
run asdf which "dummy"
|
run asdf which "dummy"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
@ -102,7 +102,7 @@ teardown() {
|
|||||||
echo 'dummy 1.0' >$PROJECT_DIR/.tool-versions
|
echo 'dummy 1.0' >$PROJECT_DIR/.tool-versions
|
||||||
rm "$ASDF_DIR/installs/dummy/1.0/bin/dummy"
|
rm "$ASDF_DIR/installs/dummy/1.0/bin/dummy"
|
||||||
|
|
||||||
run env PATH=$PATH:$ASDF_DIR/shims asdf which dummy
|
run env PATH="$PATH:$ASDF_DIR/shims" asdf which dummy
|
||||||
[ "$status" -eq 1 ]
|
[ "$status" -eq 1 ]
|
||||||
[ "$output" = "No dummy executable found for dummy 1.0" ]
|
[ "$output" = "No dummy executable found for dummy 1.0" ]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user