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)
20 _autoenv_get_file_upwards should not dereference symlinks.
25 $ _autoenv_get_file_upwards . file
27 $ _autoenv_get_file_upwards $PWD file
28 */_autoenv_utils.t/symlink/file (glob)
30 Tests for _autoenv_authorize. {{{
35 $ ! [[ -f "$AUTOENV_AUTH_FILE" ]] || cat $AUTOENV_AUTH_FILE
37 Failed authorization should keep the auth file empty.
39 $ _autoenv_authorize does-not-exist
40 Missing file argument for _autoenv_hash_pair!
42 $ cat $AUTOENV_AUTH_FILE
44 Now adding some auth pair.
47 $ _autoenv_authorize first
48 $ cat $AUTOENV_AUTH_FILE
49 :/*/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
53 $ echo second > second
54 $ _autoenv_authorize second
55 $ cat $AUTOENV_AUTH_FILE
56 :/*/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
57 :/*/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
62 $ _autoenv_authorize third
63 $ cat $AUTOENV_AUTH_FILE
64 :/*/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
65 :/*/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
66 :/*/cramtests-*/_autoenv_utils.t/third:451243482.6:2 (glob)
68 Re-add the second one, with the same hash.
70 $ _autoenv_authorize second
71 $ cat $AUTOENV_AUTH_FILE
72 :/*/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
73 :/*/cramtests-*/_autoenv_utils.t/third:451243482.6:2 (glob)
74 :/*/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
76 Re-add the first one, with a new hash.
78 $ echo one more line >> first
79 $ _autoenv_authorize first
80 $ cat $AUTOENV_AUTH_FILE
81 :/*/cramtests-*/_autoenv_utils.t/third:451243482.6:2 (glob)
82 :/*/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
83 :/*/cramtests-*/_autoenv_utils.t/first:3620404822.20:2 (glob)
87 Explicit calls to _autoenv_get_file_mtime to test alternative implementation
88 of _autoenv_get_file_mtime (via ZDOTDIR.invalid-module_path/).
90 $ _autoenv_get_file_mtime non-existing
92 $ touch -t 201401010101 file
93 $ _autoenv_get_file_mtime file
96 $ touch -t 201401010102 dir
97 $ _autoenv_get_file_mtime dir
100 Stops when last (absolute) path does not change anymore.
102 $ _autoenv_get_file_upwards / doesnotexist nevermatches