Mercurial > hg > octave-nkf
changeset 8699:6e764b7317bd
test/fntests.m, scripts/test/demo.m: error on fopen failures
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 09 Feb 2009 01:56:06 -0500 |
parents | 39666c970996 |
children | 314be237cd5b |
files | scripts/ChangeLog scripts/testfun/rundemos.m test/ChangeLog test/fntests.m |
diffstat | 4 files changed, 23 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-02-09 John W. Eaton <jwe@octave.org> + + * testfun/rundemos.m: Error if fopen fails. + 2009-02-08 John W. Eaton <jwe@octave.org> * Makefile.in (install install-strip): Don't install ls-R file.
--- a/scripts/testfun/rundemos.m +++ b/scripts/testfun/rundemos.m @@ -69,7 +69,11 @@ function retval = has_demos (f) fid = fopen (f); - str = fscanf (fid, "%s"); - fclose (fid); - retval = findstr (str, "%!demo"); + if (f < 0) + error ("fopen failed: %s", f); + else + str = fscanf (fid, "%s"); + fclose (fid); + retval = findstr (str, "%!demo"); + endif endfunction
--- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2009-02-09 John W. Eaton <jwe@octave.org> + + * fntests.m (hastests): Error if fopen fails. + 2009-01-29 John W. Eaton <jwe@octave.org> * test_system.m: Use isfield instead of struct_contains.
--- a/test/fntests.m +++ b/test/fntests.m @@ -71,10 +71,14 @@ ## FIXME -- should we only try match the keyword at the start of a line? function y = hastests (f) fid = fopen (f); - str = fread (fid, "*char")'; - fclose (fid); - y = (findstr (str, "%!test") || findstr (str, "%!assert") - || findstr (str, "%!error") || findstr (str, "%!warning")); + if (fid < 0) + error ("fopen failed: %s", f); + else + str = fread (fid, "*char")'; + fclose (fid); + y = (findstr (str, "%!test") || findstr (str, "%!assert") + || findstr (str, "%!error") || findstr (str, "%!warning")); + endif endfunction function [dp, dn, dxf, dsk] = run_test_dir (fid, d);