# HG changeset patch # User Rik # Date 1379867276 25200 # Node ID 9411ad1afa8498642efe21418dd8beb061010fe3 # Parent f271fa40074d74e1cc68fe525891abef85394e1e rundemos.m: Use regexp, instead of strfind, to report whether a file has_demos. * scripts/testfun/rundemos.m: Use regexp so that occurrences of '%!demo', possibly in comments, do not trigger running demos. * scripts/testfun/runtests.m: Don't bother to capture regexp pattern which is just discarded. diff -r f271fa40074d -r 9411ad1afa84 scripts/testfun/rundemos.m --- a/scripts/testfun/rundemos.m Sun Sep 22 08:15:59 2013 -0700 +++ b/scripts/testfun/rundemos.m Sun Sep 22 09:27:56 2013 -0700 @@ -103,9 +103,9 @@ if (f < 0) error ("rundemos: fopen failed: %s", f); else - str = fscanf (fid, "%s"); + str = fread (fid, "*char").'; fclose (fid); - retval = strfind (str, "%!demo"); + retval = ! isempty (regexp (str, '^%!demo', 'lineanchors', 'once')); endif endfunction diff -r f271fa40074d -r 9411ad1afa84 scripts/testfun/runtests.m --- a/scripts/testfun/runtests.m Sun Sep 22 08:15:59 2013 -0700 +++ b/scripts/testfun/runtests.m Sun Sep 22 09:27:56 2013 -0700 @@ -110,7 +110,7 @@ if (fid >= 0) str = fread (fid, "*char")'; fclose (fid); - retval = ! isempty (regexp (str,'^(DEFUN|DEFUN_DLD|DEFUNX)\>', + retval = ! isempty (regexp (str,'^(?:DEFUN|DEFUN_DLD|DEFUNX)\>', 'lineanchors', 'once')); else error ("fopen failed: %s", f);