diff libinterp/corefcn/pr-output.cc @ 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 cfe28edab48b
children daa281e03d9a ecc16b72bfb3
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 ()