|
@@ -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.
|