]> Sergey Matveev's repositories - zsh-autoenv.git/blobdiff - tests/setup.sh
Improve interactive prompt
[zsh-autoenv.git] / tests / setup.sh
index 49b0b3e7ba4d0809886f35847b62c87e61d1571f..90bfc510b7a37ba88641af01bcc4a022459cedef 100644 (file)
@@ -1,3 +1,18 @@
-# Ensure we have our mocked out ENV_AUTHORIZATION_FILE
+# Ensure we have our mocked out AUTOENV_ENV_FILENAME
+# (via .zshenv).
 
-[[ $ENV_AUTHORIZATION_FILE[0,4] == '/tmp' ]] || return 1
+[[ $AUTOENV_ENV_FILENAME[0,4] == '/tmp' ]] || return 1
+
+# Reset any authentication.
+echo -n > $AUTOENV_ENV_FILENAME
+
+# Add file $1 (with optional hash $2) to authentication file.
+test_autoenv_add_to_env() {
+  _autoenv_hash_pair $1 $2 >> $AUTOENV_ENV_FILENAME
+}
+
+# Add enter and leave env files to authentication file.
+test_autoenv_auth_env_files() {
+  test_autoenv_add_to_env $PWD/$AUTOENV_FILE_ENTER
+  test_autoenv_add_to_env $PWD/$AUTOENV_FILE_LEAVE
+}