]> Sergey Matveev's repositories - zsh-autoenv.git/blobdiff - tests/setup.sh
tests: define/use $TEST_SOURCE_AUTOENV
[zsh-autoenv.git] / tests / setup.sh
index 5dcb62b1010483c577a7a377cb54753d25262be1..27ba4239c446bdab4a71530af6210d5029e4edd4 100644 (file)
@@ -14,6 +14,17 @@ if [[ $AUTOENV_ENV_FILENAME[0,4] != '/tmp' ]]; then
   return 1
 fi
 
+# Abort this setup script on any error.
+_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
+$TEST_SOURCE_AUTOENV
+
 # Reset any authentication.
 echo -n >| $AUTOENV_ENV_FILENAME
 
@@ -27,3 +38,7 @@ test_autoenv_auth_env_files() {
   test_autoenv_add_to_env $PWD/$AUTOENV_FILE_ENTER
   test_autoenv_add_to_env $PWD/$AUTOENV_FILE_LEAVE
 }
+
+# Now keep on going on errors again.
+options[errexit]=$_save_errexit
+unset _save_errexit