1 Tests for internal util methods.
3 $ source $TESTDIR/setup.zsh || return 1
5 Non-existing entries are allowed and handled without error.
8 $ touch file sub/file sub/sub2/file
10 Should not get the file from the current dir.
12 $ _autoenv_get_file_upwards . file
15 $ _autoenv_get_file_upwards . file
17 $ _autoenv_get_file_upwards $PWD file
18 */_autoenv_utils.t/sub/file (glob)
21 Tests for _autoenv_authorize. {{{
26 $ ! [[ -f "$AUTOENV_AUTH_FILE" ]] || cat $AUTOENV_AUTH_FILE
28 Failed authorization should keep the auth file empty.
30 $ _autoenv_authorize does-not-exist
31 Missing file argument for _autoenv_hash_pair!
33 $ cat $AUTOENV_AUTH_FILE
35 Now adding some auth pair.
38 $ _autoenv_authorize first
39 $ cat $AUTOENV_AUTH_FILE
40 :/tmp/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
44 $ echo second > second
45 $ _autoenv_authorize second
46 $ cat $AUTOENV_AUTH_FILE
47 :/tmp/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
48 :/tmp/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
53 $ _autoenv_authorize third
54 $ cat $AUTOENV_AUTH_FILE
55 :/tmp/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
56 :/tmp/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
57 :/tmp/cramtests-*/_autoenv_utils.t/third:451243482.6:2 (glob)
59 Re-add the second one, with the same hash.
61 $ _autoenv_authorize second
62 $ cat $AUTOENV_AUTH_FILE
63 :/tmp/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
64 :/tmp/cramtests-*/_autoenv_utils.t/third:451243482.6:2 (glob)
65 :/tmp/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
67 Re-add the first one, with a new hash.
69 $ echo one more line >> first
70 $ _autoenv_authorize first
71 $ cat $AUTOENV_AUTH_FILE
72 :/tmp/cramtests-*/_autoenv_utils.t/third:451243482.6:2 (glob)
73 :/tmp/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
74 :/tmp/cramtests-*/_autoenv_utils.t/first:3620404822.20:2 (glob)
78 Explicit calls to _autoenv_get_file_mtime to test alternative implementation
79 of _autoenv_get_file_mtime (via ZDOTDIR.invalid-module_path/).
81 $ _autoenv_get_file_mtime non-existing
83 $ touch -t 201401010101 file
84 $ _autoenv_get_file_mtime file
87 $ touch -t 201401010102 dir
88 $ _autoenv_get_file_mtime dir