Mercurial > hg > octave-nkf
diff scripts/general/nargchk.m @ 12705:4972eb61c6d6
Fix bug with error() not accepting an empty struct input (Bug #33428).
* nargchk.m, nargoutchk.m: Return scalar empty struct if there is no error.
* error.cc: Accept empty struct as input with no error, per Matlab.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 04 Jun 2011 16:10:38 -0700 |
parents | fd0a3ac60b0e |
children | a4d1581f9e72 |
line wrap: on
line diff
--- a/scripts/general/nargchk.m +++ b/scripts/general/nargchk.m @@ -56,11 +56,12 @@ if (strcmpi (outtype, "string")) msg = msg.message; elseif (isempty (msg.message)) - msg = struct ([]); + msg = struct (); endif endfunction + ## Tests %!shared stmin, stmax %! stmin = struct ("message", "not enough input arguments", @@ -73,7 +74,7 @@ %!assert (nargchk (0, 1, 2), "too many input arguments") %!assert (nargchk (0, 1, 2, "string"), "too many input arguments") ## Struct outputs -%!assert (nargchk (0, 1, 0, "struct"), struct([])) -%!assert (nargchk (0, 1, 1, "struct"), struct([])) +%!assert (nargchk (0, 1, 0, "struct"), struct()) +%!assert (nargchk (0, 1, 1, "struct"), struct()) %!assert (nargchk (1, 1, 0, "struct"), stmin) %!assert (nargchk (0, 1, 2, "struct"), stmax)