1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-14 06:13:53 -05:00

Merge remote-tracking branch 'rbenv/master'

Conflicts:
	README.md
	libexec/pyenv---version
	libexec/pyenv-init
	libexec/rbenv
	libexec/rbenv-sh-shell
	libexec/rbenv-which
	test/init.bats
	test/shell.bats
This commit is contained in:
Daniel Hahler
2017-06-05 15:02:24 +02:00
7 changed files with 108 additions and 26 deletions

View File

@@ -20,14 +20,34 @@ load test_helper
assert_success 'echo "$PYENV_VERSION"'
}
@test "shell revert" {
PYENV_SHELL=bash run pyenv-sh-shell -
assert_success
assert_line 0 'if [ -n "${PYENV_VERSION_OLD+x}" ]; then'
}
@test "shell revert (fish)" {
PYENV_SHELL=fish run pyenv-sh-shell -
assert_success
assert_line 0 'if set -q PYENV_VERSION_OLD'
}
@test "shell unset" {
PYENV_SHELL=bash run pyenv-sh-shell --unset
assert_success "unset PYENV_VERSION"
assert_success
assert_output <<OUT
PYENV_VERSION_OLD="\$PYENV_VERSION"
unset PYENV_VERSION
OUT
}
@test "shell unset (fish)" {
PYENV_SHELL=fish run pyenv-sh-shell --unset
assert_success "set -e PYENV_VERSION"
assert_success
assert_output <<OUT
set -gu PYENV_VERSION_OLD "\$PYENV_VERSION"
set -e PYENV_VERSION
OUT
}
@test "shell change invalid version" {
@@ -42,11 +62,19 @@ SH
@test "shell change version" {
mkdir -p "${PYENV_ROOT}/versions/1.2.3"
PYENV_SHELL=bash run pyenv-sh-shell 1.2.3
assert_success 'export PYENV_VERSION="1.2.3"'
assert_success
assert_output <<OUT
PYENV_VERSION_OLD="\$PYENV_VERSION"
export PYENV_VERSION="1.2.3"
OUT
}
@test "shell change version (fish)" {
mkdir -p "${PYENV_ROOT}/versions/1.2.3"
PYENV_SHELL=fish run pyenv-sh-shell 1.2.3
assert_success 'setenv PYENV_VERSION "1.2.3"'
assert_success
assert_output <<OUT
set -gu PYENV_VERSION_OLD "\$PYENV_VERSION"
set -gx PYENV_VERSION "1.2.3"
OUT
}