1 $ source $TESTDIR/setup.zsh || return 1
3 Lets set a simple .autoenv.zsh action
7 $ echo 'echo ENTERED' > .autoenv.zsh
8 $ echo 'echo LEFT' > .autoenv_leave.zsh
10 Change to the directory.
12 $ _autoenv_ask_for_yes() { echo "yes"; return 0 }
14 Attempting to load unauthorized env file!
15 -* /*/cramtests-*/leave.t/sub/.autoenv.zsh (glob)
17 **********************************************
21 **********************************************
23 Would you like to authorize it? (type 'yes') yes
27 Leave the directory and answer "no".
29 $ _autoenv_ask_for_yes() { echo "no"; return 1 }
31 Attempting to load unauthorized env file!
32 -* /*/cramtests-*/leave.t/sub/.autoenv_leave.zsh (glob)
34 **********************************************
38 **********************************************
40 Would you like to authorize it? (type 'yes') no
45 $ _autoenv_ask_for_yes() { echo "yes"; return 0 }
47 Attempting to load unauthorized env file!
48 -* /*/cramtests-*/leave.t/sub/.autoenv_leave.zsh (glob)
50 **********************************************
54 **********************************************
56 Would you like to authorize it? (type 'yes') yes
60 Now check with subdirs, looking upwards.
62 $ AUTOENV_LOOK_UPWARDS=1
72 Now check with subdirs, not looking at parent dirs.
74 $ AUTOENV_LOOK_UPWARDS=0
83 Test that .autoenv.zsh is sourced only once with AUTOENV_HANDLE_LEAVE=0.
85 $ unset _autoenv_stack_entered
86 $ AUTOENV_HANDLE_LEAVE=0
93 Test that "leave" is not triggered when entering an outside dir via symlink.
95 $ AUTOENV_HANDLE_LEAVE=1
100 $ echo 'echo ENTERED outside: PWD:${PWD:t} pwd:${${"$(pwd)"}:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t} event:${autoenv_event}' > .autoenv.zsh
101 $ echo 'echo LEFT outside: PWD:${PWD:t} pwd:${${"$(pwd)"}:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t} event:${autoenv_event}' > .autoenv_leave.zsh
102 $ echo 'echo LEFT: autoenv_env_file:${autoenv_env_file}' >> .autoenv_leave.zsh
103 $ test_autoenv_auth_env_files
106 $ ln -s ../outside sub/symlink
110 ENTERED outside: PWD:symlink pwd:symlink from:sub to:symlink event:enter
114 LEFT outside: PWD:leave.t pwd:leave.t from:symlink to:leave.t event:leave
115 LEFT: autoenv_env_file:*/leave.t/sub/symlink/.autoenv_leave.zsh (glob)
117 ENTERED outside: PWD:symlink pwd:symlink from:leave.t to:symlink event:enter
119 $autoenv_env_file should not be exported.
121 $ echo -n $autoenv_env_file
123 $autoenv_env_file should be reset when leaving.
125 $ echo -n $autoenv_env_file
127 LEFT outside: PWD:leave.t pwd:leave.t from:symlink to:leave.t event:leave
128 LEFT: autoenv_env_file:*/leave.t/sub/symlink/.autoenv_leave.zsh (glob)
129 $ echo ${autoenv_env_file:-empty}