diff test/parser.tst @ 25753:b5dc88246c02 stable

disable compound binary operator optimization (bug #54465) * oct-parse.in.yy (base_parser::make_binary_op): Don't recognize compound binary operators here. * parser.tst: New tests.
author John W. Eaton <jwe@octave.org>
date Thu, 09 Aug 2018 12:19:07 -0400
parents 6652d3823428
children 00f796120a6d
line wrap: on
line diff
--- a/test/parser.tst	Sun Aug 05 11:24:06 2018 +0200
+++ b/test/parser.tst	Thu Aug 09 12:19:07 2018 -0400
@@ -337,3 +337,18 @@
 ## Check concatenation of empty char matrices (bug #52542)
 %!assert (double ([char(ones(0,3)); 'A']), 65)
 %!assert (double ([char(ones(0,3)); char(ones(2,0)); 'A']), 65)
+
+%!test <*54465>
+%! x = 0;
+%! if (! 0 || (x = 1))
+%! endif
+%! assert (x == 0);
+
+%!function x = matlab_short_circuit ()
+%!  x = 0;
+%!  if (! 0 | (x = 1))
+%!  endif
+%!endfunction
+%!test <*54465>
+%! fail ("x = matlab_short_circuit ()", "warning", "Matlab-style short-circuit operation performed for operator |");
+%! assert (x == 0);