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 -* /tmp/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 -* /tmp/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 -* /tmp/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 $ test_autoenv_auth_env_files
105 $ ln -s ../outside sub/symlink
109 ENTERED outside: PWD:symlink pwd:symlink from:sub to:symlink event:enter
113 LEFT outside: PWD:leave.t pwd:leave.t from:symlink to:leave.t event:leave
115 ENTERED outside: PWD:symlink pwd:symlink from:leave.t to:symlink event:enter
117 $autoenv_env_file should be reset when leaving.
119 $ echo $autoenv_env_file
120 */leave.t/sub/symlink/.autoenv.zsh (glob)
122 LEFT outside: PWD:leave.t pwd:leave.t from:symlink to:leave.t event:leave
123 $ echo ${autoenv_env_file:-empty}