]> Sergey Matveev's repositories - zsh-autoenv.git/blob - tests/varstash.t
tests: add and use test_autoenv_add_to_env and test_autoenv_auth_env_files
[zsh-autoenv.git] / tests / varstash.t
1 Test varstash integration.
2
3   $ source $TESTDIR/setup.sh
4
5 Setup test environment.
6
7 # Defaults:
8 # $ DOTENV_FILE_ENTER=.env
9 # $ DOTENV_FILE_LEAVE=.env.leave
10 # $ DOTENV_HANDLE_LEAVE=1
11
12   $ mkdir sub
13   $ cd sub
14   $ echo "autostash FOO=baz" > $DOTENV_FILE_ENTER
15   $ echo "autounstash" > $DOTENV_FILE_LEAVE
16
17 Manually create auth file
18
19   $ test_autoenv_auth_env_files
20
21 Set environment variable.
22
23   $ FOO=bar
24
25 Activating the env stashes it and applies a new value.
26
27   $ cd .
28   $ echo $FOO
29   baz
30
31 Leaving the directory unstashes it.
32
33   $ cd ..
34   $ echo $FOO
35   bar