changeset 10220:04f2b4d68eba

test/fntests.m (hasfunctions): assume .m files have functions
author John W. Eaton <jwe@octave.org>
date Fri, 29 Jan 2010 06:20:36 -0500
parents 979fb2606c4f
children 9b4d35fd1897
files test/ChangeLog test/fntests.m
diffstat 2 files changed, 19 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/test/ChangeLog	Fri Jan 29 05:35:13 2010 -0500
+++ b/test/ChangeLog	Fri Jan 29 06:20:36 2010 -0500
@@ -1,3 +1,8 @@
+2010-01-29  John W. Eaton  <jwe@octave.org>
+
+	* fntests.m (hasfunctions): Only check for DEFUN in .cc files.
+	Return true for all .m files.
+
 2010-01-14  David Grundberg  <davidg@cs.umu.se>
 
 	* fntests.m (run_test_script): Check all *.cc files for tests.
--- a/test/fntests.m	Fri Jan 29 05:35:13 2010 -0500
+++ b/test/fntests.m	Fri Jan 29 06:20:36 2010 -0500
@@ -69,13 +69,20 @@
 endfunction
 
 function y = hasfunctions (f)
-  fid = fopen (f);
-  if (fid < 0)
-    error ("fopen failed: %s", f);
+  n = length (f);
+  if (n > 3 && strcmp (f((end-2):end), ".cc"))
+    fid = fopen (f);
+    if (fid < 0)
+      error ("fopen failed: %s", f);
+    else
+      str = fread (fid, "*char")';
+      fclose (fid);
+      y = ! isempty (regexp (str,'^(DEFUN|DEFUN_DLD)\b', "lineanchors"));
+    endif
+  elseif (n > 2 && strcmp (f((end-1):end), ".m"))
+    y = true;
   else
-    str = fread (fid, "*char")';
-    fclose (fid);
-    y = regexp (str,'^(DEFUN|DEFUN_DLD)\b', "lineanchors");
+    y = false;
   endif
 endfunction
 
@@ -160,7 +167,7 @@
 	dsk += sk;
 	files_with_tests(end+1) = f;
       elseif (hasfunctions (f))
-	## To reduce the list length, only mark files that contains
+	## To reduce the list length, only mark .cc files that contain
 	## DEFUN definitions.
 	files_with_no_tests(end+1) = f;
       endif