Skip to content

Commit

Permalink
add arrayfun BIST for function failing to return requested output (bu…
Browse files Browse the repository at this point in the history
…g #66642)

* cellfun.cc (arrayfun): Add BIST testing for error message to be produced when
called function does not return values for requested outputs.

* cellfun.cc (cellfun): Add explanatory comment for previously added BIST.
  • Loading branch information
NRJank committed Jan 8, 2025
1 parent c9271c1 commit 8c46a73
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libinterp/corefcn/cellfun.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@ v = cellfun (@@det, C); # 40% faster
%! assert (! isempty (__errmsg));
%! clear -global __errmsg;
## An error should occur if called function does not return requested outputs
%!function [a, b] = __counterror (x)
%! a = x;
%!endfunction
Expand Down Expand Up @@ -1674,6 +1675,13 @@ arrayfun (@@str2num, [1234],
%! assert ([(isempty (A(1).message)), (isempty (A(2).message))],
%! [false, false]);
%! assert ([A(1).index, A(2).index], [1, 2]);
## An error should occur if called function does not return requested outputs
%!function [a, b] = __counterror (x)
%! a = x;
%!endfunction
%!test <66642>
%! fail ("[a, b] = arrayfun (@__counterror, [1, 4])");
*/

static void
Expand Down

0 comments on commit 8c46a73

Please sign in to comment.