changeset 32654:9f0a15acdaea

test: Add tests for interpreter of functions with too many inputs or outputs. * args.tst: Add %!error BIST tests to verify interpreter produces error when functions are called with too many inputs or outputs.
author Rik <rik@octave.org>
date Tue, 26 Dec 2023 13:19:34 -0800
parents 8dfe116fb0fe
children 916891303387
files test/args.tst
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/args.tst	Tue Dec 26 13:06:35 2023 -0800
+++ b/test/args.tst	Tue Dec 26 13:19:34 2023 -0800
@@ -33,6 +33,8 @@
 %!endfunction
 %!test
 %! f;
+%!error <function called with too many inputs> f (1)
+%!error <function called with too many outputs> y = f ()
 
 ## one input with two possible inputs
 %!function f (x, y)
@@ -41,6 +43,8 @@
 %!endfunction
 %!test
 %! f (1);
+%!error <function called with too many inputs> f (1, 2, 3)
+%!error <function called with too many outputs> y = f ()
 
 ## no inputs, one of multiple outputs
 %!function [x, y] = f ()
@@ -50,6 +54,8 @@
 %!endfunction
 %!test
 %! assert (f (), 2);
+%!error <function called with too many inputs> f (1)
+%!error <function called with too many outputs> [x, y, z] = f ()
 
 ## one of multiple inputs, one of multiple outputs
 %!function [x, y] = f (a, b)
@@ -59,6 +65,8 @@
 %!endfunction
 %!test
 %! assert (f (1), 1);
+%!error <function called with too many inputs> f (1, 2, 3)
+%!error <function called with too many outputs> [x, y, z] = f ()
 
 ########################################
 ## Varargin, varargout