From: Daniel Hahler <github@thequod.de>
Date: Tue, 29 Nov 2016 14:46:50 +0000 (+0100)
Subject: Add a test for autostashing aliases (#44)
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=d51b8ecccc58ec01206da86e7917d7819fb13e41;p=zsh-autoenv.git

Add a test for autostashing aliases (#44)

Ref: https://github.com/Tarrasch/zsh-autoenv/issues/43
---

diff --git a/tests/varstash-alias.t b/tests/varstash-alias.t
new file mode 100644
index 0000000..87a765f
--- /dev/null
+++ b/tests/varstash-alias.t
@@ -0,0 +1,38 @@
+Test varstash integration with regard to aliases.
+
+  $ source $TESTDIR/setup.zsh || return 1
+
+Setup test environment.
+
+  $ mkdir sub
+  $ cd sub
+  $ echo 'echo ENTER' > $AUTOENV_FILE_ENTER
+  $ echo 'autostash alias some_alias="echo NEW_ALIAS"' >> $AUTOENV_FILE_ENTER
+  $ echo 'echo LEAVE' > $AUTOENV_FILE_LEAVE
+  $ test_autoenv_auth_env_files
+
+Aliases should be stashed.
+
+  $ alias some_alias="echo ORIG_ALIAS"
+  $ some_alias
+  ORIG_ALIAS
+  $ cd .
+  ENTER
+  $ some_alias
+  NEW_ALIAS
+  $ cd ..
+  LEAVE
+  $ some_alias
+  ORIG_ALIAS
+
+Aliases should be stashed, if there are also environment variables.
+
+  $ some_alias=ENV_VAR
+  $ some_alias
+  ORIG_ALIAS
+  $ cd sub
+  ENTER
+  $ type -w some_alias
+  some_alias: alias
+  $ echo $some_alias
+  ENV_VAR