]> Sergey Matveev's repositories - zsh-autoenv.git/blob - tests/setup.sh
Some more refactoring, adding support for `autoenv_source_parent`
[zsh-autoenv.git] / tests / setup.sh
1 # Ensure we have our mocked out AUTOENV_ENV_FILENAME
2 # (via .zshenv).
3
4 [[ $AUTOENV_ENV_FILENAME[0,4] == '/tmp' ]] || return 1
5
6 # Reset any authentication.
7 echo -n > $AUTOENV_ENV_FILENAME
8
9 # Inject timeout for `read` while running tests.
10 _AUTOENV_TEST_READ_ARGS='-t 1'
11
12 # Add file $1 (with optional hash $2) to authentication file.
13 test_autoenv_add_to_env() {
14   _autoenv_hash_pair $1 $2 >> $AUTOENV_ENV_FILENAME
15 }
16
17 # Add enter and leave env files to authentication file.
18 test_autoenv_auth_env_files() {
19   test_autoenv_add_to_env $PWD/$AUTOENV_FILE_ENTER
20   test_autoenv_add_to_env $PWD/$AUTOENV_FILE_LEAVE
21 }