changeset 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 acd5e9df38f8
children 0f312e11957e
files test/ChangeLog test/fntests.m
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/ChangeLog	Fri Dec 25 21:38:20 2009 -0500
+++ b/test/ChangeLog	Fri Dec 25 22:26:19 2009 -0500
@@ -1,3 +1,8 @@
+2009-12-25  John W. Eaton  <jwe@octave.org>
+
+	* fntests.m (hastests): Use regexp instead of findstr and only
+	match tests that appear as the first thing on a line.
+
 2009-12-19  Rik <octave@nomad.inbox5.com>
 
 	* build_sparse_tests.sh: Use lognrnd instead of deprecated lognormal_rnd
--- 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);