1 $ source $TESTDIR/setup.zsh || return 1
3 Lets set a simple .autoenv.zsh action
5 $ echo 'echo ENTERED' > .autoenv.zsh
7 Manually create auth file
9 $ test_autoenv_add_to_env $PWD/.autoenv.zsh
13 Now try to make it accept it
15 $ _autoenv_stack_entered=()
16 $ rm $AUTOENV_AUTH_FILE
17 $ _autoenv_ask_for_yes() { echo "yes" }
19 Attempting to load unauthorized env file!
20 -* /tmp/cramtests-*/autoenv.t/.autoenv.zsh (glob)
22 **********************************************
26 **********************************************
28 Would you like to authorize it? (type 'yes') yes
32 The last "ENTERED" is because it executed the command.
34 Now lets see that it actually checks the shasum value.
36 $ _autoenv_stack_entered=()
40 $ _autoenv_stack_entered=()
41 $ rm $AUTOENV_AUTH_FILE
42 $ test_autoenv_add_to_env $PWD/.autoenv.zsh mischief
44 Attempting to load unauthorized env file!
45 -* /tmp/cramtests-*/autoenv.t/.autoenv.zsh (glob)
47 **********************************************
51 **********************************************
53 Would you like to authorize it? (type 'yes') yes
57 Now, will it take no for an answer?
59 $ _autoenv_stack_entered=()
60 $ rm $AUTOENV_AUTH_FILE
61 $ _autoenv_ask_for_yes() { echo "no"; return 1 }
63 Attempting to load unauthorized env file!
64 -* /tmp/cramtests-*/autoenv.t/.autoenv.zsh (glob)
66 **********************************************
70 **********************************************
72 Would you like to authorize it? (type 'yes') no
75 Lets also try one more time to ensure it didn't add it.
77 $ _autoenv_ask_for_yes() { echo "yes"; return 0 }
79 Attempting to load unauthorized env file!
80 -* /tmp/cramtests-*/autoenv.t/.autoenv.zsh (glob)
82 **********************************************
86 **********************************************
88 Would you like to authorize it? (type 'yes') yes
91 Reloading the script should keep the current state, e.g. when reloading your
94 $ $TEST_SOURCE_AUTOENV