# HG changeset patch # User John W. Eaton # Date 1544593834 18000 # Node ID fc7b842daca18cbafcb7ff7ea1019c16db22926e # Parent b964092ad9f81bc3b303ade9d16605f888a72f3c use inputname function instead of argn automatic variable * assert.m, test.m: Use inputname function instead of argn automatic variable to get function argument names. diff -r b964092ad9f8 -r fc7b842daca1 scripts/testfun/assert.m --- a/scripts/testfun/assert.m Tue Dec 11 17:08:10 2018 -0800 +++ b/scripts/testfun/assert.m Wed Dec 12 00:50:34 2018 -0500 @@ -88,7 +88,7 @@ || isempty (cond) || ! all (cond(:))) if (nargin == 1) ## Perhaps, say which elements failed? - argin = ["(" strjoin(cellstr (argn), ",") ")"]; + argin = ["(" inputname(1) ")"]; error ("assert %s failed", argin); else error (varargin{:}); @@ -401,7 +401,11 @@ ## Print any errors if (! isempty (err.index)) - argin = ["(" strjoin(cellstr (argn), ",") ")"]; + arg_names = cell (nargin, 1); + for i = 1:nargin + arg_names{i} = inputname (i); + endfor + argin = ["(" strjoin(arg_names, ",") ")"]; if (! isempty (errmsg)) errmsg = [errmsg "\n"]; endif diff -r b964092ad9f8 -r fc7b842daca1 scripts/testfun/test.m --- a/scripts/testfun/test.m Tue Dec 11 17:08:10 2018 -0800 +++ b/scripts/testfun/test.m Wed Dec 12 00:50:34 2018 -0500 @@ -815,7 +815,7 @@ ## Create structure with fieldnames the name of the input variables. function s = var2struct (varargin) for i = 1:nargin - s.(deblank (argn(i,:))) = varargin{i}; + s.(inputname (i)) = varargin{i}; endfor endfunction