1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-14 22:33:52 -05:00

cleanup in fish

Use process subtitution syntax:

    . (rbenv init -|psub)

instead of:

    eval (rbenv init -)

because the latter doesn't work well with newlines.
This commit is contained in:
Mislav Marohnić
2013-09-28 15:04:24 +02:00
parent 5bfec84432
commit 31fab8cdae
4 changed files with 32 additions and 11 deletions

View File

@@ -21,14 +21,14 @@ load test_helper
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
SHELL=/bin/bash run rbenv-init -
assert_success
assert_line "source '${root}/libexec/../completions/rbenv.bash'"
assert_line ". '${root}/libexec/../completions/rbenv.bash'"
}
@test "setup shell completions (fish)" {
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
SHELL=/usr/bin/fish run rbenv-init -
assert_success
assert_line '. "'${root}'/libexec/../completions/rbenv.fish";'
assert_line ". '${root}/libexec/../completions/rbenv.fish'"
}
@test "option to skip rehash" {
@@ -48,7 +48,7 @@ load test_helper
export PATH="${BATS_TEST_DIRNAME}/../libexec:/usr/bin:/bin"
SHELL=/usr/bin/fish run rbenv-init -
assert_success
assert_line 0 'setenv PATH "'${RBENV_ROOT}'/shims" $PATH ;'
assert_line 0 "setenv PATH '${RBENV_ROOT}/shims' \$PATH"
}
@test "doesn't add shims to PATH more than once" {

View File

@@ -98,3 +98,17 @@ SH
assert_success
assert_output "HELLO=:hello:ugly:world:again"
}
@test "sh-rehash in bash" {
create_executable "2.0" "ruby"
SHELL=/bin/bash run rbenv-sh-rehash
assert_success "hash -r 2>/dev/null || true"
assert [ -x "${RBENV_ROOT}/shims/ruby" ]
}
@test "sh-rehash in fish" {
create_executable "2.0" "ruby"
SHELL=/usr/bin/fish run rbenv-sh-rehash
assert_success "hash -r 2>/dev/null ; or true"
assert [ -x "${RBENV_ROOT}/shims/ruby" ]
}