# HG changeset patch # User John W. Eaton # Date 1264764036 18000 # Node ID 04f2b4d68eba54507a5450697d22e0fe3d0d3e72 # Parent 979fb2606c4fbe94983e93857afa83f7545892a8 test/fntests.m (hasfunctions): assume .m files have functions diff --git a/test/ChangeLog b/test/ChangeLog --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2010-01-29 John W. Eaton + + * fntests.m (hasfunctions): Only check for DEFUN in .cc files. + Return true for all .m files. + 2010-01-14 David Grundberg * fntests.m (run_test_script): Check all *.cc files for tests. diff --git a/test/fntests.m b/test/fntests.m --- 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