]> Sergey Matveev's repositories - zsh-autoenv.git/blobdiff - tests/_autoenv_utils.t
Handle `setopt shwordsplit` (#89)
[zsh-autoenv.git] / tests / _autoenv_utils.t
index 06025b67827c3562296052ec21e0e004099e298b..86e93c92eb50911232967492c54fe62d92a7203f 100644 (file)
@@ -13,8 +13,19 @@ Should not get the file from the current dir.
 
   $ cd sub/sub2
   $ _autoenv_get_file_upwards . file
+  ../file
+  $ _autoenv_get_file_upwards $PWD file
   */_autoenv_utils.t/sub/file (glob)
 
+_autoenv_get_file_upwards should not dereference symlinks.
+
+  $ cd ../..
+  $ ln -s sub symlink
+  $ cd symlink/sub2
+  $ _autoenv_get_file_upwards . file
+  ../file
+  $ _autoenv_get_file_upwards $PWD file
+  */_autoenv_utils.t/symlink/file (glob)
 
 Tests for _autoenv_authorize. {{{
 
@@ -35,41 +46,41 @@ Now adding some auth pair.
   $ echo first > first
   $ _autoenv_authorize first
   $ cat $AUTOENV_AUTH_FILE
-  :/tmp/cramtests-*/_autoenv_utils.t/first:271ac93c44ac198d92e706c6d6f1d84aefcfa337:1 (glob)
+  :/*/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
 
 And a second one.
 
   $ echo second > second
   $ _autoenv_authorize second
   $ cat $AUTOENV_AUTH_FILE
-  :/tmp/cramtests-*/_autoenv_utils.t/first:271ac93c44ac198d92e706c6d6f1d84aefcfa337:1 (glob)
-  :/tmp/cramtests-*/_autoenv_utils.t/second:7bee8f3b184e1e141ff76efe369c3b8bfc50e64c:1 (glob)
+  :/*/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
+  :/*/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
 
 And a third.
 
   $ echo third > third
   $ _autoenv_authorize third
   $ cat $AUTOENV_AUTH_FILE
-  :/tmp/cramtests-*/_autoenv_utils.t/first:271ac93c44ac198d92e706c6d6f1d84aefcfa337:1 (glob)
-  :/tmp/cramtests-*/_autoenv_utils.t/second:7bee8f3b184e1e141ff76efe369c3b8bfc50e64c:1 (glob)
-  :/tmp/cramtests-*/_autoenv_utils.t/third:ad180453bf8a374a15df3e90a78c180230146a7c:1 (glob)
+  :/*/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
+  :/*/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
+  :/*/cramtests-*/_autoenv_utils.t/third:451243482.6:2 (glob)
 
 Re-add the second one, with the same hash.
 
   $ _autoenv_authorize second
   $ cat $AUTOENV_AUTH_FILE
-  :/tmp/cramtests-*/_autoenv_utils.t/first:271ac93c44ac198d92e706c6d6f1d84aefcfa337:1 (glob)
-  :/tmp/cramtests-*/_autoenv_utils.t/third:ad180453bf8a374a15df3e90a78c180230146a7c:1 (glob)
-  :/tmp/cramtests-*/_autoenv_utils.t/second:7bee8f3b184e1e141ff76efe369c3b8bfc50e64c:1 (glob)
+  :/*/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
+  :/*/cramtests-*/_autoenv_utils.t/third:451243482.6:2 (glob)
+  :/*/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
 
 Re-add the first one, with a new hash.
 
   $ echo one more line >> first
   $ _autoenv_authorize first
   $ cat $AUTOENV_AUTH_FILE
-  :/tmp/cramtests-*/_autoenv_utils.t/third:ad180453bf8a374a15df3e90a78c180230146a7c:1 (glob)
-  :/tmp/cramtests-*/_autoenv_utils.t/second:7bee8f3b184e1e141ff76efe369c3b8bfc50e64c:1 (glob)
-  :/tmp/cramtests-*/_autoenv_utils.t/first:65eb010197b73ddc109b7210080f97a87f53451e:1 (glob)
+  :/*/cramtests-*/_autoenv_utils.t/third:451243482.6:2 (glob)
+  :/*/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
+  :/*/cramtests-*/_autoenv_utils.t/first:3620404822.20:2 (glob)
 }}}
 
 
@@ -85,3 +96,7 @@ of _autoenv_get_file_mtime (via ZDOTDIR.invalid-module_path/).
   $ touch -t 201401010102 dir
   $ _autoenv_get_file_mtime dir
   1388538120
+
+Stops when last (absolute) path does not change anymore.
+
+  $ _autoenv_get_file_upwards / doesnotexist nevermatches