Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: autoload with explicit path



On Tue, 17 Jan 2017 18:36:06 +0000
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> I have found a bug, though: "autoload /path/to/foo" takes effect
> even if foo is already loaded, which isn't supposed to happen.
> Test for this tomorrow.

I'll push these two together.  This also exemplifies the behaviour I was
discussing yesterday.

pws

diff --git a/Test/C04funcdef.ztst b/Test/C04funcdef.ztst
index 370394b..5edbe26 100644
--- a/Test/C04funcdef.ztst
+++ b/Test/C04funcdef.ztst
@@ -468,6 +468,31 @@
 >fun2b
 >fun2a
 
+  not_trashed() { print This function was not trashed; }
+  autoload -Uz /foo/bar/not_trashed
+  not_trashed
+0:autoload with absolute path doesn't trash loaded function
+>This function was not trashed
+
+  # keep spec from getting loaded in parent shell for simplicity
+  (
+    if whence spec; then print spec already loaded >&2; exit 1; fi
+    autoload -Uz $PWD/spec
+    autoload -Uz $PWD/extra/spec
+    spec
+  )
+0:autoload with absolute path can be overridden if not yet loaded
+>I have been loaded by explicit path.
+
+  (
+    if whence spec; then print spec already loaded >&2; exit 1; fi
+    autoload -Uz $PWD/extra/spec
+    autoload spec
+    spec
+  )
+0:autoload with absolute path not cancelled by bare autoload
+>I have been loaded by explicit path.
+
 %clean
 
  rm -f file.in file.out



Messages sorted by: Reverse Date, Date, Thread, Author