mirror of
https://github.com/Tarrasch/zsh-autoenv.git
synced 2025-12-14 02:15:11 +02:00
varstash integration
Fixes: https://github.com/Tarrasch/zsh-autoenv/issues/5
This commit is contained in:
36
tests/varstash.t
Normal file
36
tests/varstash.t
Normal file
@@ -0,0 +1,36 @@
|
||||
Test varstash integration.
|
||||
|
||||
$ source $TESTDIR/setup.sh
|
||||
|
||||
Setup test environment.
|
||||
|
||||
# Defaults:
|
||||
# $ DOTENV_FILE_ENTER=.env
|
||||
# $ DOTENV_FILE_LEAVE=.env.leave
|
||||
# $ DOTENV_HANDLE_LEAVE=1
|
||||
|
||||
$ mkdir sub
|
||||
$ cd sub
|
||||
$ echo "autostash FOO=baz" > $DOTENV_FILE_ENTER
|
||||
$ echo "autounstash" > $DOTENV_FILE_LEAVE
|
||||
|
||||
Manually create auth file
|
||||
|
||||
$ echo "$PWD/$DOTENV_FILE_ENTER:$(echo $(<$DOTENV_FILE_ENTER) | shasum)" > $ENV_AUTHORIZATION_FILE
|
||||
$ echo "$PWD/$DOTENV_FILE_LEAVE:$(echo $(<$DOTENV_FILE_LEAVE) | shasum)" >> $ENV_AUTHORIZATION_FILE
|
||||
|
||||
Set environment variable.
|
||||
|
||||
$ FOO=bar
|
||||
|
||||
Activating the env stashes it and applies a new value.
|
||||
|
||||
$ cd .
|
||||
$ echo $FOO
|
||||
baz
|
||||
|
||||
Leaving the directory unstashes it.
|
||||
|
||||
$ cd ..
|
||||
$ echo $FOO
|
||||
bar
|
||||
Reference in New Issue
Block a user