Mercurial > octave
diff scripts/help/which.m @ 23295:c1362a71fb0e
which.m: Return a non-empty string for built-in classes and command line fcns (bug #50541);
* which.m: Check return cellstr for empty values. Replace empty values with
the "type" field.
* symtab.cc: Update BIST tests for new behavior of which.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 16 Mar 2017 12:30:13 -0700 |
parents | 092078913d54 |
children | 194eb4bd202b |
line wrap: on
line diff
--- a/scripts/help/which.m Thu Mar 16 00:25:23 2017 -0500 +++ b/scripts/help/which.m Thu Mar 16 12:30:13 2017 -0700 @@ -69,6 +69,12 @@ endfor else varargout = {m.file}; + ## Return type, instead of "", for built-in classes (bug #50541). + ## FIXME: remove code if __which__ is updated to return path for classes + idx = find (cellfun ("isempty", varargout)); + if (idx) + varargout(idx) = m(idx).type; + endif endif endfunction @@ -76,18 +82,20 @@ %!test %! str = which ("ls"); -%! assert (str(end-17:end), strcat ("miscellaneous", filesep (), "ls.m")); +%! assert (str(end-17:end), fullfile ("miscellaneous", "ls.m")); %!test %! str = which ("amd"); %! assert (str(end-6:end), "amd.oct"); - -%!assert (which ("_NO_SUCH_NAME_"), "") - +%!test +%! str = which ("inputParser"); +%! assert (str, "built-in function"); %!test %! x = 3; %! str = which ("x"); %! assert (str, "variable"); +%!assert (which ("__NO_SUCH_NAME__"), "") + %!test %! str = which ("amd"); %! assert (str(end-6:end), "amd.oct"); @@ -97,3 +105,7 @@ %! clear amd; %! str = which ("amd"); %! assert (str(end-6:end), "amd.oct"); + +%!error which () +%!error which (1) +