1
0
mirror of https://github.com/Tarrasch/zsh-autoenv.git synced 2024-11-22 07:20:59 +02:00

tests: streamline ZDOTDIR layout, AUTOENV_ENV_FILENAME via setup

Without this, a new subshell would reset the env authentication file.
This commit is contained in:
Daniel Hahler 2015-04-24 17:33:09 +02:00
parent d62fbffad3
commit fd54606830
5 changed files with 10 additions and 18 deletions

View File

@ -1,3 +1,4 @@
# Source base setup.
source ${ZDOTDIR}/../ZDOTDIR/.zshenv source ${ZDOTDIR}/../ZDOTDIR/.zshenv
setopt noclobber setopt noclobber

View File

@ -10,4 +10,5 @@ zstat() {
echo "Should not get called." echo "Should not get called."
} }
# Source base setup.
source ${ZDOTDIR}/../ZDOTDIR/.zshenv source ${ZDOTDIR}/../ZDOTDIR/.zshenv

View File

@ -1,11 +1,7 @@
test -f "$TESTDIR/.zcompdump" && rm "$TESTDIR/.zcompdump" # Source base setup.
source ${ZDOTDIR}/../ZDOTDIR/.zshenv
AUTOENV_DEBUG=0
antigen-like-loader-function() { antigen-like-loader-function() {
source "$TESTDIR/../autoenv.plugin.zsh" source "$TESTDIR/../autoenv.plugin.zsh"
} }
TEST_SOURCE_AUTOENV=antigen-like-loader-function
export AUTOENV_ENV_FILENAME="$PWD/.env_auth"
echo -n > $AUTOENV_ENV_FILENAME

View File

@ -1,7 +1,3 @@
test -f "$TESTDIR/.zcompdump" && rm "$TESTDIR/.zcompdump" # Base setup/config.
AUTOENV_DEBUG=0 TEST_SOURCE_AUTOENV=(source $TESTDIR/../autoenv.plugin.zsh)
export AUTOENV_ENV_FILENAME="$PWD/.env_auth"
echo -n > $AUTOENV_ENV_FILENAME

View File

@ -9,6 +9,8 @@
# Not handled in varstash yet. # Not handled in varstash yet.
# setopt nounset # setopt nounset
export AUTOENV_ENV_FILENAME="$CRAMTMP/.env_auth"
if [[ $AUTOENV_ENV_FILENAME[0,4] != '/tmp' ]]; then if [[ $AUTOENV_ENV_FILENAME[0,4] != '/tmp' ]]; then
echo "AUTOENV_ENV_FILENAME is not in /tmp. Aborting." echo "AUTOENV_ENV_FILENAME is not in /tmp. Aborting."
return 1 return 1
@ -18,11 +20,7 @@ fi
_save_errexit=${options[errexit]} _save_errexit=${options[errexit]}
set -e set -e
if (( ${+functions[antigen-like-loader-function]} )); then # Defined in .zshenv, e.g. tests/ZDOTDIR/.zshenv.
TEST_SOURCE_AUTOENV=antigen-like-loader-function
else
TEST_SOURCE_AUTOENV=(source $TESTDIR/../autoenv.plugin.zsh)
fi
$TEST_SOURCE_AUTOENV $TEST_SOURCE_AUTOENV
# Reset any authentication. # Reset any authentication.