changeset 33489:9d6b329ca141 stable

bar.m: Catch input number validation error and return print_usage * bar.m: Add input check for nargin < 1 and call to print_usage rather than sending error producing input to __bar__.m Update input validation BIST to check for print_usage error message.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Mon, 29 Apr 2024 16:25:13 -0400
parents e1ef298c6907
children 13695d1ea7f2 8cfedb86d373
files scripts/plot/draw/bar.m
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/draw/bar.m	Mon Apr 29 10:47:03 2024 -0400
+++ b/scripts/plot/draw/bar.m	Mon Apr 29 16:25:13 2024 -0400
@@ -113,6 +113,9 @@
 ## @end deftypefn
 
 function varargout = bar (varargin)
+  if (nargin < 1)
+    print_usage;
+  endif
   varargout = cell (nargout, 1);
   [varargout{:}] = __bar__ ("bar", true, varargin{:});
 endfunction
@@ -145,7 +148,7 @@
 %! title ("stacked bar() graph including intermingled negative values");
 
 %% Test input validation
-%!error bar ()
+%!error <Invalid call> bar ()
 %!error <Y must be numeric> bar ("foo")
 %!error <X must be a vector> bar ([1 2; 3 4], [1 2 3 4])
 %!error <X vector values must be unique> bar ([1 2 3 3], [1 2 3 4])