1
0
mirror of https://github.com/Tarrasch/zsh-autoenv.git synced 2024-06-26 01:50:11 +03: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
setopt noclobber

View File

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

View File

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

View File

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

View File

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