comparison libinterp/parse-tree/oct-parse.yy @ 26716:daa281e03d9a

Harden BIST tests against changes in format(). * oct-parse.yy: Save/restore format before running some evalc() tests. * Map.m: Save/restore format and change %!error to %!test with fail(). * pr-output.cc (Frats): Save/restore format before running rats() tests.
author Rik <rik@octave.org>
date Sun, 10 Feb 2019 08:39:30 -0800
parents 17e7d310def8
children 9b0335f4bc74
comparison
equal deleted inserted replaced
26715:24e11ee4fe45 26716:daa281e03d9a
5746 return retval; 5746 return retval;
5747 } 5747 }
5748 5748
5749 /* 5749 /*
5750 5750
5751 %!assert (evalc ("1"), "ans = 1\n") 5751 %!test
5752 %! [old_fmt, old_spacing] = format ();
5753 %! unwind_protect
5754 %! format short;
5755 %! str = evalc ("1");
5756 %! assert (str, "ans = 1\n");
5757 %! unwind_protect_cleanup
5758 %! format (old_fmt);
5759 %! format (old_spacing);
5760 %! end_unwind_protect
5761
5752 %!assert (evalc ("1;"), "") 5762 %!assert (evalc ("1;"), "")
5753 5763
5754 %!test 5764 %!test
5755 %! [s, y] = evalc ("1"); 5765 %! [s, y] = evalc ("1");
5756 %! assert (s, ""); 5766 %! assert (s, "");
5760 %! [s, y] = evalc ("1;"); 5770 %! [s, y] = evalc ("1;");
5761 %! assert (s, ""); 5771 %! assert (s, "");
5762 %! assert (y, 1); 5772 %! assert (y, 1);
5763 5773
5764 %!test 5774 %!test
5765 %! assert (evalc ("y = 2"), "y = 2\n"); 5775 %! [old_fmt, old_spacing] = format ();
5766 %! assert (y, 2); 5776 %! unwind_protect
5777 %! format short;
5778 %! str = evalc ("y = 2");
5779 %! assert (str, "y = 2\n");
5780 %! assert (y, 2);
5781 %! unwind_protect_cleanup
5782 %! format (old_fmt);
5783 %! format (old_spacing);
5784 %! end_unwind_protect
5767 5785
5768 %!test 5786 %!test
5769 %! assert (evalc ("y = 3;"), ""); 5787 %! assert (evalc ("y = 3;"), "");
5770 %! assert (y, 3); 5788 %! assert (y, 3);
5771 5789