# HG changeset patch # User Rik # Date 1256005069 25200 # Node ID 9f8ff01abc657d0f12603b2e4cca0fe6c491d6c9 # Parent 36840b4ebda6a80ed3b19ca50a30788d068be1f7 .cc files are now included in the list of files requiring tests only if they define a user function (DEFUN or DEFUN_DLD) diff -r 36840b4ebda6 -r 9f8ff01abc65 test/ChangeLog --- a/test/ChangeLog Mon Oct 19 19:13:57 2009 -0700 +++ b/test/ChangeLog Mon Oct 19 19:17:49 2009 -0700 @@ -1,4 +1,9 @@ -2009-10-08 Rik +2009-10-19 Rik + + * fntests.m: .cc files are now included in the list of files requiring + tests only if they define a user function (DEFUN or DEFUN_DLD) + +2009-10-19 Rik * fntests.m: Remove deprecated functions from list of functions requiring new tests to be written diff -r 36840b4ebda6 -r 9f8ff01abc65 test/fntests.m --- a/test/fntests.m Mon Oct 19 19:13:57 2009 -0700 +++ b/test/fntests.m Mon Oct 19 19:17:49 2009 -0700 @@ -68,6 +68,17 @@ puts ("\n"); endfunction +function y = hasfunctions (f) + fid = fopen (f); + if (fid < 0) + error ("fopen failed: %s", f); + else + str = fread (fid, "*char")'; + fclose (fid); + y = regexp (str,'^(DEFUN|DEFUN_DLD)\b', "lineanchors"); + endif +endfunction + ## FIXME -- should we only try match the keyword at the start of a line? function y = hastests (f) fid = fopen (f); @@ -128,9 +139,9 @@ endfor for i = 1:length (lst) nm = lst(i).name; - if ((length (nm) > 3 && strcmp (nm((end-2):end), ".cc")) - || (length (nm) > 2 && strcmp (nm((end-1):end), ".m"))) - f = fullfile (d, nm); + f = fullfile (d, nm); + if ((length (nm) > 2 && strcmp (nm((end-1):end), ".m")) || + (length (nm) > 3 && strcmp (nm((end-2):end), ".cc") && hasfunctions(f))) p = n = xf = 0; ## Only run if it contains %!test, %!assert %!error or %!warning if (hastests (f))