From 10732c1d8aadd280e05e5e325dffdabb606ed1d8 Mon Sep 17 00:00:00 2001 From: Christian Fredrik Johnsen Date: Sat, 14 Dec 2024 10:05:29 +0100 Subject: [PATCH] test: fix 'setup shell completion' tests. The old tests seems to have been copy-paste from some 11 year old rubyenv setup, and included a long and windy pathname. The old setup was extremely bad in my view, current test is much better. Exported variables are local to the specific test, so they will not affect other test instances. ---> Enables us to remove unnecessary `root` variable in pyenv-init. --- test/init.bats | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/init.bats b/test/init.bats index 273114d6..16314d76 100755 --- a/test/init.bats +++ b/test/init.bats @@ -35,12 +35,12 @@ create_executable() { assert_line "command pyenv rehash 2>/dev/null" } - @test "setup shell completions" { root="$(cd $BATS_TEST_DIRNAME/.. && pwd)" + export PYENV_ROOT=$root run pyenv-init - bash assert_success - assert_line "source '${root}/test/../libexec/../completions/pyenv.bash'" + assert_line "source '${root}/completions/pyenv.bash'" } @test "detect parent shell" { @@ -64,9 +64,10 @@ OUT @test "setup shell completions (fish)" { root="$(cd $BATS_TEST_DIRNAME/.. && pwd)" + export PYENV_ROOT=$root run pyenv-init - fish assert_success - assert_line "source '${root}/test/../libexec/../completions/pyenv.fish'" + assert_line "source '${root}/completions/pyenv.fish'" } @test "fish instructions" {