Mercurial > hg > octave-lojdl
changeset 17141: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 | 7066eec3431c |
children | e4968b4613a5 |
files | scripts/plot/close.m |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
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" +