changeset 33609:e3ae86170488 stable

barh: Add input validation check for nargin < 1. * Add input validation check for barh call with no input arguments and call print_usage. Update BIST to check for error message.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Sun, 19 May 2024 22:31:11 -0400
parents ca190a4a366c
children f5b433492c16
files scripts/plot/draw/barh.m
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/draw/barh.m	Sat May 18 22:29:53 2024 -0400
+++ b/scripts/plot/draw/barh.m	Sun May 19 22:31:11 2024 -0400
@@ -77,6 +77,9 @@
 ## @end deftypefn
 
 function varargout = barh (varargin)
+  if (nargin < 1)
+    print_usage;
+  endif
   varargout = cell (nargout, 1);
   [varargout{:}] = __bar__ ("barh", false, varargin{:});
 endfunction
@@ -103,7 +106,7 @@
 %! title ("stacked barh() graph including intermingled negative values");
 
 %% Test input validation
-%!error barh ()
+%!error <Invalid call> bar ()
 %!error <Y must be numeric> barh ("foo")
 %!error <X must be a vector> barh ([1 2; 3 4], [1 2 3 4])
 %!error <X vector values must be unique> barh ([1 2 3 3], [1 2 3 4])