# HG changeset patch # User Rik # Date 1377133585 25200 # Node ID 5a65b2cc950831026c0f800d6456c4cfb06fe0a6 # Parent 5a6caf617f56c820feca766fa9d770d88bd4a941 test: Add tests for 'end' form of 'endfor', 'endif', etc. * test/for.tst, test/if.tst, test/jit.tst, test/switch.tst, test/try.tst, test/unwind.tst, test/while.tst: Add tests for 'end' form of 'endfor', 'endif', etc. diff -r 5a6caf617f56 -r 5a65b2cc9508 test/for.tst --- a/test/for.tst Wed Aug 21 17:17:16 2013 -0700 +++ b/test/for.tst Wed Aug 21 18:06:25 2013 -0700 @@ -19,7 +19,7 @@ %!test %! for i = 1 %! __printf_assert__ ("%d", i); -%! end +%! end # "end" is part of test, check not using "endfor" %! __printf_assert__ ("\n"); %! assert (__prog_output_assert__ ("1")); @@ -101,8 +101,8 @@ %! assert (i, {1 + 2*j; 2 + 2*j++}) %! endfor -%% test parsing of single-quoted character string appearing at the -%% beginning of a for loop +## test parsing of single-quoted character string appearing at the +## beginning of a for loop %!test %! for i = 1:5 %! 'foo'; diff -r 5a6caf617f56 -r 5a65b2cc9508 test/if.tst --- a/test/if.tst Wed Aug 21 17:17:16 2013 -0700 +++ b/test/if.tst Wed Aug 21 18:06:25 2013 -0700 @@ -21,7 +21,7 @@ %! if (i == 0) %! i++; %! __printf_assert__ ("%d\n", i); -%! endif +%! end # "end" is part of test, check not using "endif" %! assert (__prog_output_assert__ ("1")); %!test @@ -29,7 +29,7 @@ %! __printf_assert__ ("fail\n"); %! else %! __printf_assert__ ("pass\n"); -%! end +%! endif %! assert (__prog_output_assert__ ("pass")); %!test @@ -50,7 +50,7 @@ %! __printf_assert__ ("fail\n"); %! elseif (y) %! __printf_assert__ ("pass\n"); -%! end +%! endif %! assert (__prog_output_assert__ ("pass")); %!test @@ -76,11 +76,11 @@ %! __printf_assert__ ("fail\n"); %! elseif (x) %! __printf_assert__ ("fail\n"); -%! end +%! endif %! assert (__prog_output_assert__ ("pass")); -%% test parsing of single-quoted character string appearing at the -%% beginning of an if condition +## test parsing of single-quoted character string appearing at the +## beginning of an if condition %!test %! if (1) %! 'foo'; @@ -88,8 +88,8 @@ %! endif %! assert (x, 13); -%% test parsing of single-quoted character string appearing at the -%% beginning of an if condition +## test parsing of single-quoted character string appearing at the +## beginning of an if condition %!test %! if (0) %! x = 42; @@ -98,3 +98,4 @@ %! x = 13; %! endif %! assert (x, 13); + diff -r 5a6caf617f56 -r 5a65b2cc9508 test/jit.tst --- a/test/jit.tst Wed Aug 21 17:17:16 2013 -0700 +++ b/test/jit.tst Wed Aug 21 18:06:25 2013 -0700 @@ -130,7 +130,7 @@ %! endif %! endfor %! catch -%! end +%! end_try_catch %! assert (result == 500); %!function result = gen_test (n) diff -r 5a6caf617f56 -r 5a65b2cc9508 test/switch.tst --- a/test/switch.tst Wed Aug 21 17:17:16 2013 -0700 +++ b/test/switch.tst Wed Aug 21 18:06:25 2013 -0700 @@ -21,7 +21,8 @@ %! b = 2; %! c = 3; %! -%! switch (0) case 1 x = a; case 2 x = b; otherwise x = c; endswitch +%! ## "end" is part of test, check not using "endswitch" +%! switch (0) case 1 x = a; case 2 x = b; otherwise x = c; end %! switch (1) case 1 y = a; case 2 y = b; otherwise y = c; endswitch %! switch (2) case 1 z = a; case 2 z = b; otherwise z = c; endswitch %! switch (3) case 1 p = a; case 2 p = b; otherwise p = c; endswitch diff -r 5a6caf617f56 -r 5a65b2cc9508 test/try.tst --- a/test/try.tst Wed Aug 21 17:17:16 2013 -0700 +++ b/test/try.tst Wed Aug 21 18:06:25 2013 -0700 @@ -20,7 +20,7 @@ %! try %! catch %! error ("Shoudn't get here"); -%! end_try_catch +%! end # "end" is part of test, check not using "end_try_catch" %!test %! try diff -r 5a6caf617f56 -r 5a65b2cc9508 test/unwind.tst --- a/test/unwind.tst Wed Aug 21 17:17:16 2013 -0700 +++ b/test/unwind.tst Wed Aug 21 18:06:25 2013 -0700 @@ -28,7 +28,7 @@ %! unwind_protect_cleanup %! g = save_g; %! y = [y, g]; -%! end_unwind_protect +%! end # "end" is part of test, check not using "end_unwind_protect" %!endfunction %! %!test diff -r 5a6caf617f56 -r 5a65b2cc9508 test/while.tst --- a/test/while.tst Wed Aug 21 17:17:16 2013 -0700 +++ b/test/while.tst Wed Aug 21 18:06:25 2013 -0700 @@ -21,7 +21,7 @@ %! while (eye (2)) %! i++; %! __printf_assert__ ("%d\n", i); -%! endwhile +%! end # "end" is part of test, check not using "endwhile" %! assert (__prog_output_assert__ ("")); %!test