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

tests: define/use $TEST_SOURCE_AUTOENV

This handled (re)loading autoenv for
ZDOTDIR=tests/ZDOTDIR.loadviafunction.
This commit is contained in:
Daniel Hahler 2015-04-23 16:00:12 +02:00
parent 102a3f2f44
commit ebef4c2613
4 changed files with 9 additions and 6 deletions

View File

@ -5,7 +5,6 @@ AUTOENV_DEBUG=0
antigen-like-loader-function() { antigen-like-loader-function() {
source "$TESTDIR/../autoenv.plugin.zsh" source "$TESTDIR/../autoenv.plugin.zsh"
} }
antigen-like-loader-function
export AUTOENV_ENV_FILENAME="$PWD/.env_auth" export AUTOENV_ENV_FILENAME="$PWD/.env_auth"

View File

@ -91,5 +91,5 @@ Lets also try one more time to ensure it didn't add it.
Reloading the script should keep the current state, e.g. when reloading your Reloading the script should keep the current state, e.g. when reloading your
~/.zshrc. ~/.zshrc.
$ source $TEST_AUTOENV_PLUGIN_FILE $ $TEST_SOURCE_AUTOENV
$ cd . $ cd .

View File

@ -18,8 +18,12 @@ fi
_save_errexit=${options[errexit]} _save_errexit=${options[errexit]}
set -e set -e
export TEST_AUTOENV_PLUGIN_FILE="$TESTDIR/../autoenv.plugin.zsh" if (( ${+functions[antigen-like-loader-function]} )); then
source $TEST_AUTOENV_PLUGIN_FILE TEST_SOURCE_AUTOENV=antigen-like-loader-function
else
TEST_SOURCE_AUTOENV=(source $TESTDIR/../autoenv.plugin.zsh)
fi
$TEST_SOURCE_AUTOENV
# Reset any authentication. # Reset any authentication.
echo -n >| $AUTOENV_ENV_FILENAME echo -n >| $AUTOENV_ENV_FILENAME

View File

@ -35,14 +35,14 @@ The variable is not available in a subshell, only the exported one.
Activate autoenv in the subshell. Activate autoenv in the subshell.
$ $SHELL -c 'source $TEST_AUTOENV_PLUGIN_FILE; echo ${MYVAR}; echo $MYEXPORT' $ $SHELL -c "$TEST_SOURCE_AUTOENV; echo \${MYVAR}; echo \$MYEXPORT"
ENTER ENTER
changed changed
changed_export changed_export
"autounstash" should handle the exported variables. "autounstash" should handle the exported variables.
$ $SHELL -c 'source $TEST_AUTOENV_PLUGIN_FILE; cd ..; echo ${MYVAR:-empty}; echo $MYEXPORT' $ $SHELL -c "$TEST_SOURCE_AUTOENV; cd ..; echo \${MYVAR:-empty}; echo \$MYEXPORT"
ENTER ENTER
LEAVE LEAVE
empty empty