Mercurial > hg > octave-lyh
diff scripts/general/nargoutchk.m @ 12865:a4d1581f9e72
Return correct struct for nargchk, nargoutchk (Bug #33808).
* nargchk.m, nargoutchk.m: Return struct with message and identifier fields
when number of arguments is valid, not just an empty struct.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Wed, 20 Jul 2011 10:41:59 -0700 |
parents | 4972eb61c6d6 |
children | 49553ea11764 |
line wrap: on
line diff
--- a/scripts/general/nargoutchk.m +++ b/scripts/general/nargoutchk.m @@ -55,15 +55,15 @@ if (strcmpi (outtype, "string")) msg = msg.message; - elseif (isempty (msg.message)) - msg = struct (); endif endfunction ## Tests -%!shared stmin, stmax +%!shared stnul, stmin, stmax +%! stnul = struct ("message", "", +%! "identifier", ""); %! stmin = struct ("message", "not enough output arguments", %! "identifier", "Octave:nargoutchk:not-enough-outputs"); %! stmax = struct ("message", "too many output arguments", @@ -74,7 +74,8 @@ %!assert (nargoutchk (0, 1, 2), "too many output arguments") %!assert (nargoutchk (0, 1, 2, "string"), "too many output arguments") ## Struct outputs -#%!assert (nargoutchk (0, 1, 0, "struct"), struct()) -#%!assert (nargoutchk (0, 1, 1, "struct"), struct()) -#%!assert (nargoutchk (1, 1, 0, "struct"), stmin) -#%!assert (nargoutchk (0, 1, 2, "struct"), stmax) +%!assert (nargoutchk (0, 1, 0, "struct"), stnul) +%!assert (nargoutchk (0, 1, 1, "struct"), stnul) +%!assert (nargoutchk (1, 1, 0, "struct"), stmin) +%!assert (nargoutchk (0, 1, 2, "struct"), stmax) +