mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Write test for the exec-path functionality in the which command
This commit is contained in:
parent
c37307a2cc
commit
8bcf8caba4
@ -35,6 +35,17 @@ install_dummy_version() {
|
||||
install_mock_plugin_version "dummy" "$1"
|
||||
}
|
||||
|
||||
install_dummy_exec_path_script() {
|
||||
local name=$1
|
||||
local exec_path="$ASDF_DIR/plugins/dummy/bin/exec-path"
|
||||
local custom_dir="$ASDF_DIR/installs/dummy/1.0/bin/custom"
|
||||
mkdir "$custom_dir"
|
||||
touch "$custom_dir/$name"
|
||||
chmod +x "$custom_dir/$name"
|
||||
echo "echo 'bin/custom'" > "$exec_path"
|
||||
chmod +x "$exec_path"
|
||||
}
|
||||
|
||||
clean_asdf_dir() {
|
||||
rm -rf "$BASE_DIR"
|
||||
unset ASDF_DIR
|
||||
|
@ -51,3 +51,12 @@ teardown() {
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "No executable binary found for bazbat" ]
|
||||
}
|
||||
|
||||
@test "which should use path returned by exec-path when present" {
|
||||
cd $PROJECT_DIR
|
||||
install_dummy_exec_path_script "dummy"
|
||||
|
||||
run which_command "dummy"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "$ASDF_DIR/installs/dummy/1.0/bin/custom/dummy" ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user