zsh-workers
 help / color / mirror / code / Atom feed
* Test/V01zmodload.ztst
@ 2001-05-18 12:11 Bart Schaefer
  2001-05-18 13:06 ` Test/V01zmodload.ztst Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2001-05-18 12:11 UTC (permalink / raw)
  To: zsh-workers

While I was waiting for that drive to check (it never did succeed, sigh)
I wrote up the test script for the zmodload command and committed it.

Currently one of the tests fails:  After defining an autoloaded math func,
you can't undefine it again, even if the module has not been loaded.  It's
probably something incredibly simple, but I'm not up to pursuing it right
now, so if you want "make check" to pass you have to comment out the line
`zmodload -uf bogus'.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Test/V01zmodload.ztst
  2001-05-18 12:11 Test/V01zmodload.ztst Bart Schaefer
@ 2001-05-18 13:06 ` Peter Stephenson
  2001-05-18 16:05   ` Test/V01zmodload.ztst Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2001-05-18 13:06 UTC (permalink / raw)
  To: Zsh hackers list

Bart wrote:
> Currently one of the tests fails:  After defining an autoloaded math func,
> you can't undefine it again, even if the module has not been loaded.  It's
> probably something incredibly simple, but I'm not up to pursuing it right
> now, so if you want "make check" to pass you have to comment out the line
> `zmodload -uf bogus'.

There's a typo here --- using CONDF_* flags instead of MFF_* flags.
Actually that doesn't change anything because they're both defined to 2,
so that's not the real problem.

What's happening is simple enough --- addmathfunc adds the `added' flag
straight away, which is what is tested to see if the function was
autoloaded, so this is screwy.  Probably add_automathfunc() shouldn't be
allowing addmathfunc() to add the MFF_ADDED flag, it should be done when
the module is loaded.  The following seems to work.

Index: Src/module.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/module.c,v
retrieving revision 1.8
diff -u -r1.8 module.c
--- Src/module.c	2001/01/16 13:44:20	1.8
+++ Src/module.c	2001/05/18 13:06:13
@@ -1346,7 +1346,7 @@
     int ret = 0;
 
     if (ops['u']) {
-	/* remove autoloaded conditions */
+	/* remove autoloaded math functions */
 	for (; *args; args++) {
 	    MathFunc f = getmathfunc(*args, 0);
 
@@ -1355,7 +1355,7 @@
 		    zwarnnam(nam, "%s: no such math function", *args, 0);
 		    ret = 1;
 		}
-	    } else if (f->flags & CONDF_ADDED) {
+	    } else if (f->flags & MFF_ADDED) {
 		zwarnnam(nam, "%s: math function is already defined", *args, 0);
 		ret = 1;
 	    } else
@@ -1377,7 +1377,7 @@
 	}
 	return 0;
     } else {
-	/* add autoloaded conditions */
+	/* add autoloaded math functions */
 	char *modnam;
 
 	modnam = *args++;
@@ -2119,6 +2119,8 @@
 
 	return 1;
     }
+    f->flags &= ~MFF_ADDED; /* still to autoload, not added yet */
+
     return 0;
 }
 
 
-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Test/V01zmodload.ztst
  2001-05-18 13:06 ` Test/V01zmodload.ztst Peter Stephenson
@ 2001-05-18 16:05   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2001-05-18 16:05 UTC (permalink / raw)
  To: Zsh hackers list

A couple of tweaks:

Several of the tests now send output to fd 8, but fd 8 was only opened
when $ZTST_verbose was non-empty and -ge 0.  So you could for example
break the tests with `ZTST_verbose=-1 make check'.

The V01* hunk fixes a typo in a comment, and warns when some of the tests
are being skipped.

diff -u zsh-forge/current/Test/V01zmodload.ztst zsh-4.0/Test/V01zmodload.ztst
--- zsh-forge/current/Test/V01zmodload.ztst	Fri May 18 05:08:08 2001
+++ zsh-4.0/Test/V01zmodload.ztst	Fri May 18 09:01:30 2001
@@ -27,9 +27,9 @@
 1:Test reloading an already-loaded module
 ?ZTST_execchunk:zmodload:2: module zsh/main already loaded.
 
-# Loop over the modules fond above and attempt to load each one.  Use
+# Loop over the modules found above and attempt to load each one.  Use
 # the -i flag in case dependencies cause multiple modules to be loaded,
-# or in case some previous test loaded a module.
+# or in case some previous test suite loaded a module.
 
  for m in $mods
  do
@@ -74,7 +74,7 @@
    zmodload -ab zsh/example example
    builtin example
    zmodload -e zsh/example
- else :
+ else print -u8 Warning: zsh/example not linked: not checking autoloading
  fi
 0d:Autoload a module via a builtin
 
diff -u zsh-forge/current/Test/ztst.zsh zsh-4.0/Test/ztst.zsh
--- zsh-forge/current/Test/ztst.zsh	Fri May 11 18:38:13 2001
+++ zsh-4.0/Test/ztst.zsh	Fri May 18 08:57:33 2001
@@ -115,7 +115,7 @@
 
 [[ ! -r $ZTST_testname ]] && ZTST_testfailed "can't read test file."
 
-[[ -n $ZTST_verbose && $ZTST_verbose -ge 0 ]] && exec 8>&1
+exec 8>&1
 exec 9<$ZTST_testname
 
 # The current line read from the test file.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-05-18 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-18 12:11 Test/V01zmodload.ztst Bart Schaefer
2001-05-18 13:06 ` Test/V01zmodload.ztst Peter Stephenson
2001-05-18 16:05   ` Test/V01zmodload.ztst Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).