diff test/try.tst @ 17283:e6c0ac8ce5b6

eliminate parse conflicts introduced by changeset 923ce8b42db2 * oct-parse.in.yy (opt_identifier): Delete. (TRY): Simplify grammar. (octave_base_parser::make_try_command): Pass separator token instead of exception identifier. Handle exception identifier here based on context instead of in grammar rules. * parse.h (octave_base_parser::make_try_command): Fix decl. * try.tst: New tests.
author John W. Eaton <jwe@octave.org>
date Tue, 20 Aug 2013 06:42:54 -0400
parents 923ce8b42db2
children 5a65b2cc9508
line wrap: on
line diff
--- a/test/try.tst	Mon Aug 19 22:24:05 2013 -0700
+++ b/test/try.tst	Tue Aug 20 06:42:54 2013 -0400
@@ -158,3 +158,25 @@
 %!   assert (myerr1.message, myerr2.message);
 %!   assert (myerr1.identifier, myerr2.identifier);
 %! end_try_catch
+
+%!test
+%! x = 1;
+%! try error ("foo"); catch x; assert (x.message, "foo"); end_try_catch
+
+%!test
+%! x = 1;
+%! try error ("foo"); catch x end_try_catch
+%! assert (x.message, "foo");
+
+%!test
+%! x = 1;
+%! try error ("foo"); catch, x; assert (x, 1); end_try_catch
+
+%!test
+%! x = 1;
+%! try error ("foo"); catch; x; assert (x, 1); end_try_catch
+
+%!test
+%! x = 1;
+%! try error ("foo"); catch
+%!   x; assert (x, 1); end_try_catch