# HG changeset patch # User Rik # Date 1443240029 25200 # Node ID 76f67400649eb5eec8e84801483ee0bc63fd695d # Parent 71e60880105a0d9f6f72322758a1da752570b470 Use '-local' option to warning to simplify BIST tests. * dos.m, unix.m, savepath.m, kurtosis.m, skewness.m: Use '-local' option to warning instead of unwind/protect block. diff -r 71e60880105a -r 76f67400649e scripts/miscellaneous/dos.m --- a/scripts/miscellaneous/dos.m Fri Sep 25 18:50:41 2015 -0700 +++ b/scripts/miscellaneous/dos.m Fri Sep 25 21:00:29 2015 -0700 @@ -51,13 +51,8 @@ %!test %! cmd = ls_command (); -%! old_wstate = warning ("query"); -%! warning ("off", "Octave:undefined-return-values"); -%! unwind_protect -%! [status, output] = dos (cmd); -%! unwind_protect_cleanup -%! warning (old_wstate); -%! end_unwind_protect +%! warning ("off", "Octave:undefined-return-values", "local"); +%! [status, output] = dos (cmd); %! %! if (ispc () && ! isunix ()) %! [status, output] = dos (cmd); diff -r 71e60880105a -r 76f67400649e scripts/miscellaneous/unix.m --- a/scripts/miscellaneous/unix.m Fri Sep 25 18:50:41 2015 -0700 +++ b/scripts/miscellaneous/unix.m Fri Sep 25 21:00:29 2015 -0700 @@ -51,13 +51,8 @@ %!test %! cmd = ls_command (); -%! old_wstate = warning ("query"); -%! warning ("off", "Octave:undefined-return-values"); -%! unwind_protect -%! [status, output] = unix (cmd); -%! unwind_protect_cleanup -%! warning (old_wstate); -%! end_unwind_protect +%! warning ("off", "Octave:undefined-return-values", "local"); +%! [status, output] = unix (cmd); %! %! if (isunix ()) %! assert (status, 0); diff -r 71e60880105a -r 76f67400649e scripts/path/savepath.m --- a/scripts/path/savepath.m Fri Sep 25 18:50:41 2015 -0700 +++ b/scripts/path/savepath.m Fri Sep 25 21:00:29 2015 -0700 @@ -202,7 +202,7 @@ %! assert (fid >= 0); %! fclose (fid); %! ## Save path into local .octaverc file -%! warning ("off", "Octave:savepath-local"); +%! warning ("off", "Octave:savepath-local", "local"); %! status = savepath (); %! assert (status == 0); %! ## Compare old and new versions diff -r 71e60880105a -r 76f67400649e scripts/statistics/base/kurtosis.m --- a/scripts/statistics/base/kurtosis.m Fri Sep 25 18:50:41 2015 -0700 +++ b/scripts/statistics/base/kurtosis.m Fri Sep 25 21:00:29 2015 -0700 @@ -151,15 +151,10 @@ ## Verify no "divide-by-zero" warnings %!test -%! wstate = warning ("query", "Octave:divide-by-zero"); -%! warning ("on", "Octave:divide-by-zero"); -%! unwind_protect -%! lastwarn (""); # clear last warning -%! kurtosis (1); -%! assert (lastwarn (), ""); -%! unwind_protect_cleanup -%! warning (wstate, "Octave:divide-by-zero"); -%! end_unwind_protect +%! warning ("on", "Octave:divide-by-zero", "local"); +%! lastwarn (""); # clear last warning +%! kurtosis (1); +%! assert (lastwarn (), ""); ## Test input validation %!error kurtosis () @@ -171,3 +166,4 @@ %!error kurtosis (1, [], 1.5) %!error kurtosis (1, [], 0) %!error kurtosis (1, [], 3) + diff -r 71e60880105a -r 76f67400649e scripts/statistics/base/skewness.m --- a/scripts/statistics/base/skewness.m Fri Sep 25 18:50:41 2015 -0700 +++ b/scripts/statistics/base/skewness.m Fri Sep 25 21:00:29 2015 -0700 @@ -152,15 +152,10 @@ ## Verify no "divide-by-zero" warnings %!test -%! wstate = warning ("query", "Octave:divide-by-zero"); -%! warning ("on", "Octave:divide-by-zero"); -%! unwind_protect -%! lastwarn (""); # clear last warning -%! skewness (1); -%! assert (lastwarn (), ""); -%! unwind_protect_cleanup -%! warning (wstate, "Octave:divide-by-zero"); -%! end_unwind_protect +%! warning ("on", "Octave:divide-by-zero", "local"); +%! lastwarn (""); # clear last warning +%! skewness (1); +%! assert (lastwarn (), ""); ## Test input validation %!error skewness () @@ -172,3 +167,4 @@ %!error skewness (1, [], 1.5) %!error skewness (1, [], 0) %!error skewness (1, [], 3) +