Test that asdf exec works even if asdf shims are not in PATH.

This commit is contained in:
Victor Hugo Borja 2019-01-19 20:09:53 -06:00
parent e51f778b61
commit 6da747b6ce
3 changed files with 18 additions and 2 deletions

View File

@ -4,6 +4,8 @@
Features Features
* Shims can be invoked directly via `asdf exec <tool> [args...]` without requiring to have all shims on path (#374).
* Configurable command hooks from `.asdfrc` * Configurable command hooks from `.asdfrc`
Suppose a `foo` plugin is installed and provides a `bar` executable, Suppose a `foo` plugin is installed and provides a `bar` executable,
The following hooks will be executed when set: The following hooks will be executed when set:

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# remove this asdf-exec file when v0.7 becomes the stable version # remove this asdf-exec file when releasing >=0.6.5
echo "asdf is self upgrading shims to new asdf-tool-exec" echo "asdf is self upgrading shims to new asdf exec ..."
asdf_dir="$(dirname "$(dirname "$(dirname "$0")")")" asdf_dir="$(dirname "$(dirname "$(dirname "$0")")")"
# shellcheck source=lib/utils.sh # shellcheck source=lib/utils.sh

View File

@ -30,6 +30,20 @@ teardown() {
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
} }
@test "asdf exec should pass all arguments to executable even if shim is not in PATH" {
echo "dummy 1.0" > $PROJECT_DIR/.tool-versions
run install_command
path=$(echo "$PATH" | sed -e "s|$(asdf_data_dir)/shims||g; s|::|:|g")
run env PATH=$path which dummy
[ "$output" == "" ]
[ "$status" -eq 1 ]
run env PATH=$path $ASDF_DIR/bin/asdf exec dummy world hello
[ "$output" == "This is Dummy 1.0! hello world" ]
[ "$status" -eq 0 ]
}
@test "shim exec should pass all arguments to executable" { @test "shim exec should pass all arguments to executable" {
echo "dummy 1.0" > $PROJECT_DIR/.tool-versions echo "dummy 1.0" > $PROJECT_DIR/.tool-versions
run install_command run install_command