2017-10-18 01:31:43 +03:00
|
|
|
Test unstash behavior on leaving.
|
|
|
|
|
|
|
|
$ source $TESTDIR/setup.zsh || return 1
|
|
|
|
|
|
|
|
Setup test environment.
|
|
|
|
|
2017-12-14 01:53:25 +02:00
|
|
|
$ mkdir -p sub/sub2
|
2017-10-18 01:31:43 +03:00
|
|
|
$ echo 'echo ENTER; stash FOO=changed' >| sub/$AUTOENV_FILE_ENTER
|
|
|
|
$ echo 'echo LEAVE; unstash FOO' >| sub/$AUTOENV_FILE_LEAVE
|
|
|
|
$ test_autoenv_auth_env_files sub
|
|
|
|
$ FOO=orig
|
|
|
|
|
|
|
|
Activating the env stashes it and applies a new value.
|
|
|
|
|
2017-12-14 01:53:25 +02:00
|
|
|
$ cd sub/sub2
|
2017-10-18 01:31:43 +03:00
|
|
|
ENTER
|
|
|
|
$ echo $FOO
|
|
|
|
changed
|
|
|
|
|
|
|
|
Leaving the directory unstashes it (varstash_dir is set to prev dir).
|
|
|
|
|
2017-12-14 01:53:25 +02:00
|
|
|
$ cd -
|
2017-10-18 01:31:43 +03:00
|
|
|
LEAVE
|
|
|
|
$ echo $FOO
|
|
|
|
orig
|