view test/bug-38565.tst @ 20166:196871335aa8

Allow call with empty argument list in strcat related functions (bug #44981) * libinterp/corefcn/strfns.cc (strvcat): return an empty string for an empty argument list. Simply dropping the input checking, will return an empty string. This makes it more consistent with cat(), vertcat, and horzcat() functions, which return [] for this cases. It makes it easier to support "strcat (cell{:})" when cell is empty. * scripts/strings/cstrcat.m, scripts/strings/strcat.m: same as above. But because [cellstr{:}] when cellstr is empty returns double ([]), we specifically return "".
author Carnë Draug <carandraug@octave.org>
date Fri, 01 May 2015 16:21:39 +0100
parents b9e510a1f308
children
line wrap: on
line source

%!function r = f (x)
%!  if (ischar (x))
%!    r = x;
%!  else
%!    error ("expecting character string");
%!  endif
%!endfunction

%!assert (eval ("f 10;"), "10");