view test/bug-53599.tst @ 31155:44b9673c7b8d stable

correct subsasgn docstring example code (bug #33221) * libinterp/octave-value/ov.cc (subsasgn): add LHS variable to example code in docstring reconcile example result with the following one-line command.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Fri, 22 Jul 2022 15:30:29 -0400
parents 9080316864bf
children
line wrap: on
line source

%!function rval = sggval (val)
%!  global gval
%!  if (nargin == 1)
%!    gval = val;
%!  else
%!    rval = gval;
%!  endif
%!endfunction

%!test <*53599>
%! global gval
%! assert (isempty (gval))
%! sggval (13);
%! assert (sggval (), 13);
%! assert (gval, 13);
%! clear global gval
%! assert (sggval (), [])
%! gval = 42;
%! assert (sggval (), []);
%! clear gval
%! global gval
%! gval = 42;
%! assert (sggval (), 42);
%! clear -global gval;  # cleanup after test