Mercurial > hg > octave-nkf
diff test/fntests.m @ 9742:9f8ff01abc65
.cc files are now included in the list of files requiring
tests only if they define a user function (DEFUN or DEFUN_DLD)
author | Rik <rdrider0-list@yahoo.com> |
---|---|
date | Mon, 19 Oct 2009 19:17:49 -0700 |
parents | 36840b4ebda6 |
children | 9b3a100922a6 |
line wrap: on
line diff
--- a/test/fntests.m +++ b/test/fntests.m @@ -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))