Mercurial > hg > octave-nkf
diff test/fntests.m @ 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 | fddfebeeb33a |
children | 686e3bc432a2 |
line wrap: on
line diff
--- a/test/fntests.m +++ b/test/fntests.m @@ -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