Mercurial > hg > octave-nkf
diff scripts/plot/close.m @ 17135:723a08d266d2
close.m: Add input validation for 2 input args and %!error test blocks.
* scripts/plot/close.m: Add input validation for 2 input args and %!error test
blocks.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 01 Aug 2013 08:46:12 -0700 |
parents | eaab03308c0b |
children | bc924baa2c4e |
line wrap: on
line diff
--- a/scripts/plot/close.m +++ b/scripts/plot/close.m @@ -70,12 +70,14 @@ elseif (isempty (arg1)) figs = []; else - error ('close: expecting argument to be "all" or a figure handle'); + error ('close: first argument must be "all" or a figure handle'); endif elseif ( ischar (arg1) && strcmpi (arg1, "all") && ischar (arg2) && strcmpi (arg2, "hidden")) figs = (allchild (0))'; figs = figs(isfigure (figs)); + else + error ('close: expecting argument to be "all hidden"'); endif for h = figs @@ -94,10 +96,16 @@ %! unwind_protect %! close (hf); %! objs = findobj ("type", "figure"); -%! assert (isempty (intersect (objs, hf))); +%! assert (! any (objs == hf)); %! unwind_protect_cleanup %! if (isfigure (hf)) %! close (hf); %! endif %! end_unwind_protect +%!error close (1,2,3) +%!error <first argument must be "all" or a figure> close ({"all"}) +%!error <first argument must be "all" or a figure> close ("all_and_more") +%!error <first argument must be "all" or a figure> close (-1) +%!error <expecting argument to be "all hidden"> close "all" hid" +