Mercurial > octave
changeset 26585:d673b506f382 stable
test: use "format short" in tests depending on output format (bug #55539)
* pr-output.cc: Apply "format short" on evalc tests assuming short output
display format, restore original output format.
* oct-parse.yy: Likewise.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Mon, 21 Jan 2019 13:27:28 -0800 |
parents | ada14ef3067f |
children | 745e3d3814a4 |
files | libinterp/corefcn/pr-output.cc libinterp/parse-tree/oct-parse.yy |
diffstat | 2 files changed, 29 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc Sat Jan 19 18:22:48 2019 +0100 +++ b/libinterp/corefcn/pr-output.cc Mon Jan 21 13:27:28 2019 -0800 @@ -3387,12 +3387,26 @@ /* %!test -%! str = evalc ("x = 1.1; display (x)"); -%! assert (str, "x = 1.1000\n"); +%! [old_fmt, old_spacing] = format (); +%! unwind_protect +%! format short; +%! str = evalc ("x = 1.1; display (x)"); +%! assert (str, "x = 1.1000\n"); +%! unwind_protect_cleanup +%! format (old_fmt); +%! format (old_spacing); +%! end_unwind_protect %!test -%! str = evalc ("display (1.1)"); -%! assert (str, " 1.1000\n"); +%! [old_fmt, old_spacing] = format (); +%! unwind_protect +%! format short; +%! str = evalc ("display (1.1)"); +%! assert (str, " 1.1000\n"); +%! unwind_protect_cleanup +%! format (old_fmt); +%! format (old_spacing); +%! end_unwind_protect ## Test input validation %!error display ()
--- a/libinterp/parse-tree/oct-parse.yy Sat Jan 19 18:22:48 2019 +0100 +++ b/libinterp/parse-tree/oct-parse.yy Mon Jan 21 13:27:28 2019 -0800 @@ -5819,10 +5819,17 @@ %! b = 2; %!endfunction %!test -%! [s, a, b] = evalc ("__f_evalc ()"); -%! assert (s, "foobar 3.1416\n"); -%! assert (a, 1); -%! assert (b, 2); +%! [old_fmt, old_spacing] = format (); +%! unwind_protect +%! format short; +%! [s, a, b] = evalc ("__f_evalc ()"); +%! assert (s, "foobar 3.1416\n"); +%! assert (a, 1); +%! assert (b, 2); +%! unwind_protect_cleanup +%! format (old_fmt); +%! format (old_spacing); +%! end_unwind_protect %!error <foo> (evalc ("error ('foo')")) %!error <bar> (evalc ("error ('foo')", "error ('bar')"))