changeset 17309:5a65b2cc9508

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.
author Rik <rik@octave.org>
date Wed, 21 Aug 2013 18:06:25 -0700
parents 5a6caf617f56
children b327c19b6b16
files test/for.tst test/if.tst test/jit.tst test/switch.tst test/try.tst test/unwind.tst test/while.tst
diffstat 7 files changed, 18 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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';
--- 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);
+
--- 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)
--- 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
--- 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
--- 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
--- 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