mirror of
https://github.com/Tarrasch/zsh-autoenv.git
synced 2025-12-14 02:15:11 +02:00
tests: setup for multiple ZDOTDIRs, fix/add "setopt clobber"
This commit is contained in:
3
tests/ZDOTDIR.clobber/.zshenv
Normal file
3
tests/ZDOTDIR.clobber/.zshenv
Normal file
@@ -0,0 +1,3 @@
|
||||
source ${ZDOTDIR}/../ZDOTDIR/.zshenv
|
||||
|
||||
setopt noclobber
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Lets set a simple .env action
|
||||
|
||||
$ echo 'echo ENTERED' >> .env
|
||||
$ echo 'echo ENTERED' > .env
|
||||
|
||||
Manually create auth file
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ Lets set a simple .env action
|
||||
|
||||
$ mkdir sub
|
||||
$ cd sub
|
||||
$ echo 'echo ENTERED' >> .env
|
||||
$ echo 'echo LEFT' >> .env.leave
|
||||
$ echo 'echo ENTERED' > .env
|
||||
$ echo 'echo LEFT' > .env.leave
|
||||
|
||||
Change to the directory.
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ Prepend call to autoenv_source_parent to sub/.env file.
|
||||
|
||||
Add sub/sub2/.env file.
|
||||
|
||||
$ echo -e "echo autoenv_source_parent_from_sub2:\nautoenv_source_parent\necho done_sub2\n" > sub2/.env
|
||||
$ echo -e "echo autoenv_source_parent_from_sub2:\nautoenv_source_parent\necho done_sub2\n" >| sub2/.env
|
||||
$ test_autoenv_add_to_env sub2/.env
|
||||
$ cd sub2
|
||||
autoenv_source_parent_from_sub2:
|
||||
@@ -109,7 +109,7 @@ Changing the root .env should trigger re-authentication via autoenv_source_paren
|
||||
|
||||
First, let's answer "no".
|
||||
|
||||
$ echo "echo NEW" > .env
|
||||
$ echo "echo NEW" >| .env
|
||||
$ _autoenv_ask_for_yes() { echo "no"; return 1 }
|
||||
$ cd sub
|
||||
autoenv_source_parent_from_sub:
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
[[ $AUTOENV_ENV_FILENAME[0,4] == '/tmp' ]] || return 1
|
||||
|
||||
# Reset any authentication.
|
||||
echo -n > $AUTOENV_ENV_FILENAME
|
||||
echo -n >| $AUTOENV_ENV_FILENAME
|
||||
|
||||
# Add file $1 (with optional hash $2) to authentication file.
|
||||
test_autoenv_add_to_env() {
|
||||
_autoenv_hash_pair $1 ${2:-} >> $AUTOENV_ENV_FILENAME
|
||||
_autoenv_hash_pair $1 ${2:-} >>| $AUTOENV_ENV_FILENAME
|
||||
}
|
||||
|
||||
# Add enter and leave env files to authentication file.
|
||||
|
||||
@@ -39,8 +39,8 @@ Setup:
|
||||
$ unset VAR
|
||||
$ cd sub
|
||||
ENTER
|
||||
$ echo 'echo ENTER; autostash VAR=changed' > $AUTOENV_FILE_ENTER
|
||||
$ echo 'echo LEAVE; echo "no explicit call to autounstash"' > $AUTOENV_FILE_LEAVE
|
||||
$ echo 'echo ENTER; autostash VAR=changed' >| $AUTOENV_FILE_ENTER
|
||||
$ echo 'echo LEAVE; echo "no explicit call to autounstash"' >| $AUTOENV_FILE_LEAVE
|
||||
$ test_autoenv_auth_env_files
|
||||
|
||||
$VAR is unset:
|
||||
|
||||
Reference in New Issue
Block a user