mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 17:49:13 +02:00
* Added two test cases from Mantis #28584. The issue itself has been fixed with r31475 and r31582.
git-svn-id: trunk@32092 -
This commit is contained in:
parent
3344188f3e
commit
72f60de3c4
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user