mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-12 13:33:45 -05:00
@@ -19,6 +19,18 @@ load test_helper
|
||||
assert_line "shell"
|
||||
}
|
||||
|
||||
@test "commands in path with spaces" {
|
||||
path="${RBENV_TEST_DIR}/my commands"
|
||||
cmd="${path}/rbenv-sh-hello"
|
||||
mkdir -p "$path"
|
||||
touch "$cmd"
|
||||
chmod +x "$cmd"
|
||||
|
||||
PATH="${path}:$PATH" run rbenv-commands --sh
|
||||
assert_success
|
||||
assert_line "hello"
|
||||
}
|
||||
|
||||
@test "commands --no-sh" {
|
||||
run rbenv-commands --no-sh
|
||||
assert_success
|
||||
|
||||
14
test/exec.bats
Normal file
14
test/exec.bats
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
@test "supports hook path with spaces" {
|
||||
hook_path="${RBENV_TEST_DIR}/custom stuff/rbenv hooks"
|
||||
mkdir -p "${hook_path}/exec"
|
||||
echo "export HELLO='from hook'" > "${hook_path}/exec/hello.bash"
|
||||
|
||||
export RBENV_VERSION=system
|
||||
RBENV_HOOK_PATH="$hook_path" run rbenv-exec env
|
||||
assert_success
|
||||
assert_line "HELLO=from hook"
|
||||
}
|
||||
@@ -28,6 +28,18 @@ create_hook() {
|
||||
assert_line 2 "${RBENV_TEST_DIR}/etc/rbenv_hooks/exec/bueno.bash"
|
||||
}
|
||||
|
||||
@test "supports hook paths with spaces" {
|
||||
path1="${RBENV_TEST_DIR}/my hooks/rbenv.d"
|
||||
path2="${RBENV_TEST_DIR}/etc/rbenv hooks"
|
||||
create_hook "$path1" exec "hello.bash"
|
||||
create_hook "$path2" exec "ahoy.bash"
|
||||
|
||||
RBENV_HOOK_PATH="$path1:$path2" run rbenv-hooks exec
|
||||
assert_success
|
||||
assert_line 0 "${RBENV_TEST_DIR}/my hooks/rbenv.d/exec/hello.bash"
|
||||
assert_line 1 "${RBENV_TEST_DIR}/etc/rbenv hooks/exec/ahoy.bash"
|
||||
}
|
||||
|
||||
@test "resolves relative paths" {
|
||||
path="${RBENV_TEST_DIR}/rbenv.d"
|
||||
create_hook "$path" exec "hello.bash"
|
||||
|
||||
Reference in New Issue
Block a user