Make work in set -u (nounset) mode

This commit is contained in:
Ville Skyttä 2020-04-23 08:14:56 +03:00
parent c2cfbd1e8b
commit a5a1c4d50d
2 changed files with 4 additions and 4 deletions

View file

@ -49,7 +49,7 @@ if [ "$version" = "--unset" ]; then
echo "set -e RBENV_VERSION"
;;
* )
echo 'RBENV_VERSION_OLD="$RBENV_VERSION"'
echo 'RBENV_VERSION_OLD="${RBENV_VERSION-}"'
echo "unset RBENV_VERSION"
;;
esac
@ -107,7 +107,7 @@ if rbenv-prefix "$version" >/dev/null; then
echo "set -gx RBENV_VERSION \"$version\""
;;
* )
echo 'RBENV_VERSION_OLD="$RBENV_VERSION"'
echo 'RBENV_VERSION_OLD="${RBENV_VERSION-}"'
echo "export RBENV_VERSION=\"$version\""
;;
esac

View file

@ -47,7 +47,7 @@ load test_helper
RBENV_SHELL=bash run rbenv-sh-shell --unset
assert_success
assert_output <<OUT
RBENV_VERSION_OLD="\$RBENV_VERSION"
RBENV_VERSION_OLD="\${RBENV_VERSION-}"
unset RBENV_VERSION
OUT
}
@ -75,7 +75,7 @@ SH
RBENV_SHELL=bash run rbenv-sh-shell 1.2.3
assert_success
assert_output <<OUT
RBENV_VERSION_OLD="\$RBENV_VERSION"
RBENV_VERSION_OLD="\${RBENV_VERSION-}"
export RBENV_VERSION="1.2.3"
OUT
}