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

rbenv shell: properly declare global variables for zsh (#1566)

With zsh `setopt warn_create_global` the "shell" command used to cause
a warning message:

    scalar parameter RBENV_VERSION_OLD created globally in function rbenv.

By using `typeset -g` specifically for zsh, this warning goes away.
This commit is contained in:
Mislav Marohnić
2024-04-29 14:20:21 +02:00
committed by GitHub
parent e8b7a27ee6
commit f2ac882579
2 changed files with 36 additions and 0 deletions

View File

@@ -80,6 +80,16 @@ export RBENV_VERSION="1.2.3"
OUT
}
@test "shell change version (zsh)" {
mkdir -p "${RBENV_ROOT}/versions/1.2.3"
RBENV_SHELL=zsh run rbenv-sh-shell 1.2.3
assert_success
assert_output <<OUT
typeset -g RBENV_VERSION_OLD="\${RBENV_VERSION-}"
export RBENV_VERSION="1.2.3"
OUT
}
@test "shell change version (fish)" {
mkdir -p "${RBENV_ROOT}/versions/1.2.3"
RBENV_SHELL=fish run rbenv-sh-shell 1.2.3