diff test/fntests.m @ 10026:9b3a100922a6

fntests.m: use regexp instead of findstr and only recognize tests that are the first thing on a line
author John W. Eaton <jwe@octave.org>
date Fri, 25 Dec 2009 22:26:19 -0500
parents 9f8ff01abc65
children fddfebeeb33a
line wrap: on
line diff
--- a/test/fntests.m	Fri Dec 25 21:38:20 2009 -0500
+++ b/test/fntests.m	Fri Dec 25 22:26:19 2009 -0500
@@ -87,8 +87,8 @@
   else
     str = fread (fid, "*char")';
     fclose (fid);
-    y = (findstr (str, "%!test") || findstr (str, "%!assert")
-	 || findstr (str, "%!error") || findstr (str, "%!warning"));
+    y = ! isempty (regexp (str, "^[ \t]*%!(test|assert|error|warning)",
+                           "lineanchors"));
   endif
 endfunction
 
@@ -101,7 +101,7 @@
     nm = lst(i).name;
     if (length (nm) > 5 && strcmp (nm(1:5), "test_")
 	&& strcmp (nm((end-1):end), ".m"))
-      p = n = 0;
+      p = n = xf = sk = 0;
       ffnm = fullfile (d, nm);
       if (hastests (ffnm))
 	print_test_file_name (nm);