mirror of
https://github.com/pyenv/pyenv.git
synced 2024-12-22 04:20:46 +00:00
Add tests for rbenv PATH and RBENV_HOOK_PATH handling
This commit is contained in:
parent
07d675350f
commit
bf39d88d11
2 changed files with 31 additions and 1 deletions
|
@ -1,2 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
eval "echo \$$1"
|
||||
# Usage: rbenv echo [-F<char>] VAR
|
||||
|
||||
if [[ $1 == -F* ]]; then
|
||||
sep="${1:2}"
|
||||
echo "${!2}" | tr "${sep:-:}" $'\n'
|
||||
else
|
||||
echo "${!1}"
|
||||
fi
|
||||
|
|
|
@ -45,3 +45,26 @@ load test_helper
|
|||
assert_failure
|
||||
assert_output "rbenv: cannot change working directory to \`$dir'"
|
||||
}
|
||||
|
||||
@test "adds its own libexec to PATH" {
|
||||
run rbenv echo "PATH"
|
||||
assert_success "${BATS_TEST_DIRNAME%/*}/libexec:$PATH"
|
||||
}
|
||||
|
||||
@test "adds plugin bin dirs to PATH" {
|
||||
mkdir -p "$RBENV_ROOT"/plugins/ruby-build/bin
|
||||
mkdir -p "$RBENV_ROOT"/plugins/rbenv-each/bin
|
||||
run rbenv echo -F: "PATH"
|
||||
assert_success
|
||||
assert_line 0 "${BATS_TEST_DIRNAME%/*}/libexec"
|
||||
assert_line 1 "${RBENV_ROOT}/plugins/ruby-build/bin"
|
||||
assert_line 2 "${RBENV_ROOT}/plugins/rbenv-each/bin"
|
||||
}
|
||||
|
||||
@test "RBENV_HOOK_PATH preserves value from environment" {
|
||||
RBENV_HOOK_PATH=/my/hook/path:/other/hooks run rbenv echo -F: "RBENV_HOOK_PATH"
|
||||
assert_success
|
||||
assert_line 0 "/my/hook/path"
|
||||
assert_line 1 "/other/hooks"
|
||||
assert_line 2 "${RBENV_ROOT}/rbenv.d"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue