mirror of
https://github.com/Tarrasch/zsh-autoenv.git
synced 2024-12-22 10:50:16 +02:00
tests: define/use $TEST_SOURCE_AUTOENV
This handled (re)loading autoenv for ZDOTDIR=tests/ZDOTDIR.loadviafunction.
This commit is contained in:
parent
102a3f2f44
commit
ebef4c2613
@ -5,7 +5,6 @@ AUTOENV_DEBUG=0
|
||||
antigen-like-loader-function() {
|
||||
source "$TESTDIR/../autoenv.plugin.zsh"
|
||||
}
|
||||
antigen-like-loader-function
|
||||
|
||||
export AUTOENV_ENV_FILENAME="$PWD/.env_auth"
|
||||
|
||||
|
@ -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
|
||||
~/.zshrc.
|
||||
|
||||
$ source $TEST_AUTOENV_PLUGIN_FILE
|
||||
$ $TEST_SOURCE_AUTOENV
|
||||
$ cd .
|
||||
|
@ -18,8 +18,12 @@ fi
|
||||
_save_errexit=${options[errexit]}
|
||||
set -e
|
||||
|
||||
export TEST_AUTOENV_PLUGIN_FILE="$TESTDIR/../autoenv.plugin.zsh"
|
||||
source $TEST_AUTOENV_PLUGIN_FILE
|
||||
if (( ${+functions[antigen-like-loader-function]} )); then
|
||||
TEST_SOURCE_AUTOENV=antigen-like-loader-function
|
||||
else
|
||||
TEST_SOURCE_AUTOENV=(source $TESTDIR/../autoenv.plugin.zsh)
|
||||
fi
|
||||
$TEST_SOURCE_AUTOENV
|
||||
|
||||
# Reset any authentication.
|
||||
echo -n >| $AUTOENV_ENV_FILENAME
|
||||
|
@ -35,14 +35,14 @@ The variable is not available in a subshell, only the exported one.
|
||||
|
||||
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
|
||||
changed
|
||||
changed_export
|
||||
|
||||
"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
|
||||
LEAVE
|
||||
empty
|
||||
|
Loading…
Reference in New Issue
Block a user