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
16 */_autoenv_utils.t/sub/file (glob)
19 Tests for _autoenv_authorize. {{{
24 $ ! [[ -f "$AUTOENV_AUTH_FILE" ]] || cat $AUTOENV_AUTH_FILE
26 Failed authorization should keep the auth file empty.
28 $ _autoenv_authorize does-not-exist
29 Missing file argument for _autoenv_hash_pair!
31 $ cat $AUTOENV_AUTH_FILE
33 Now adding some auth pair.
36 $ _autoenv_authorize first
37 $ cat $AUTOENV_AUTH_FILE
38 :/tmp/cramtests-*/_autoenv_utils.t/first:271ac93c44ac198d92e706c6d6f1d84aefcfa337:1 (glob)
42 $ echo second > second
43 $ _autoenv_authorize second
44 $ cat $AUTOENV_AUTH_FILE
45 :/tmp/cramtests-*/_autoenv_utils.t/first:271ac93c44ac198d92e706c6d6f1d84aefcfa337:1 (glob)
46 :/tmp/cramtests-*/_autoenv_utils.t/second:7bee8f3b184e1e141ff76efe369c3b8bfc50e64c:1 (glob)
51 $ _autoenv_authorize third
52 $ cat $AUTOENV_AUTH_FILE
53 :/tmp/cramtests-*/_autoenv_utils.t/first:271ac93c44ac198d92e706c6d6f1d84aefcfa337:1 (glob)
54 :/tmp/cramtests-*/_autoenv_utils.t/second:7bee8f3b184e1e141ff76efe369c3b8bfc50e64c:1 (glob)
55 :/tmp/cramtests-*/_autoenv_utils.t/third:ad180453bf8a374a15df3e90a78c180230146a7c:1 (glob)
57 Re-add the second one, with the same hash.
59 $ _autoenv_authorize second
60 $ cat $AUTOENV_AUTH_FILE
61 :/tmp/cramtests-*/_autoenv_utils.t/first:271ac93c44ac198d92e706c6d6f1d84aefcfa337:1 (glob)
62 :/tmp/cramtests-*/_autoenv_utils.t/third:ad180453bf8a374a15df3e90a78c180230146a7c:1 (glob)
63 :/tmp/cramtests-*/_autoenv_utils.t/second:7bee8f3b184e1e141ff76efe369c3b8bfc50e64c:1 (glob)
65 Re-add the first one, with a new hash.
67 $ echo one more line >> first
68 $ _autoenv_authorize first
69 $ cat $AUTOENV_AUTH_FILE
70 :/tmp/cramtests-*/_autoenv_utils.t/third:ad180453bf8a374a15df3e90a78c180230146a7c:1 (glob)
71 :/tmp/cramtests-*/_autoenv_utils.t/second:7bee8f3b184e1e141ff76efe369c3b8bfc50e64c:1 (glob)
72 :/tmp/cramtests-*/_autoenv_utils.t/first:65eb010197b73ddc109b7210080f97a87f53451e:1 (glob)
76 Explicit calls to _autoenv_get_file_mtime to test alternative implementation
77 of _autoenv_get_file_mtime (via ZDOTDIR.invalid-module_path/).
79 $ _autoenv_get_file_mtime non-existing
81 $ touch -t 201401010101 file
82 $ _autoenv_get_file_mtime file
85 $ touch -t 201401010102 dir
86 $ _autoenv_get_file_mtime dir