]> Sergey Matveev's repositories - zsh-autoenv.git/blobdiff - tests/varstash.t
Only source varstash lib if it's being used
[zsh-autoenv.git] / tests / varstash.t
index 487230b5d8bfb42c050d789a94e8a5d1ace47fd8..dd730c468ed3d348d7d6f72ddec1cdc09ab210ff 100644 (file)
@@ -1,16 +1,27 @@
 Test varstash integration.
 
-  $ source $TESTDIR/setup.sh
+  $ source $TESTDIR/setup.zsh || return 1
 
 Setup test environment.
 
   $ mkdir sub
   $ cd sub
-  $ echo 'echo ENTER; autostash FOO=changed' > $AUTOENV_FILE_ENTER
-  $ echo 'echo LEAVE; autounstash' > $AUTOENV_FILE_LEAVE
 
-Manually create auth file
+The varstash library should not get loaded always.
 
+  $ echo 'echo ENTER' > $AUTOENV_FILE_ENTER
+  $ echo 'echo LEAVE' > $AUTOENV_FILE_LEAVE
+  $ test_autoenv_auth_env_files
+  $ cd .
+  ENTER
+  $ type -w autostash
+  autostash: none
+  [1]
+
+Now on to some stashing.
+
+  $ echo 'echo ENTER; autostash FOO=changed' > $AUTOENV_FILE_ENTER
+  $ echo 'echo LEAVE; autounstash' > $AUTOENV_FILE_LEAVE
   $ test_autoenv_auth_env_files
 
 Set environment variable.
@@ -19,8 +30,12 @@ Set environment variable.
 
 Activating the env stashes it and applies a new value.
 
-  $ cd .
+  $ cd ..
+  LEAVE
+  $ cd sub
   ENTER
+  $ type -w autostash
+  autostash: function
   $ echo $FOO
   changed