Browse Source

* Added two test cases from Mantis #28584. The issue itself has been fixed with r31475 and r31582.

git-svn-id: trunk@32092 -
sergei 9 years ago
parent
commit
72f60de3c4
1 changed files with 55 additions and 0 deletions
  1. 55 0
      tests/test/cg/ttryfin5.pp

+ 55 - 0
tests/test/cg/ttryfin5.pp

@@ -52,6 +52,51 @@ begin
   end;
 end;
 
+{ test 4: 'continue' in try..except nested in loop nested in try..finally
+           in this case the control stays within protected region
+           (Mantis #28584)  }
+procedure test4;
+var
+  i: integer;
+begin
+  try
+    for i:=0 to 2 do
+    begin
+      try
+        inc(counter);
+        raise exception.create('catch me');
+      except
+        continue;
+      end;
+    end;  
+  finally
+    inc(counter);
+  end;
+end;
+
+{ test 5: same as above but with 'break' statement instead }
+procedure test5;
+var
+  i: integer;
+begin
+  try
+    for i:=0 to 15 do
+    begin
+      try
+        inc(counter);
+        raise exception.create('catch me');
+      except
+        if i=2 then
+          break;
+      end;
+    end; 
+    inc(counter);
+  finally
+    inc(counter);
+  end;
+end;
+
+
 
 begin
   counter:=0;
@@ -68,4 +113,14 @@ begin
   test3;
   if counter<>2 then
     Halt(3);
+    
+  counter:=0;
+  test4;
+  if counter<>4 then
+    Halt(4);
+    
+  counter:=0;
+  test5;
+  if counter<>5 then
+    Halt(5);
 end.