mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 22:39:36 +02:00
+ exception level test
This commit is contained in:
parent
c93f715239
commit
fa407afadd
@ -21,7 +21,7 @@ procedure test_exception(const s : string);
|
|||||||
var
|
var
|
||||||
i,j : longint;
|
i,j : longint;
|
||||||
e : extended;
|
e : extended;
|
||||||
exception_count : longint;
|
exception_count,level : longint;
|
||||||
begin
|
begin
|
||||||
j:=0;
|
j:=0;
|
||||||
i:=100;
|
i:=100;
|
||||||
@ -81,15 +81,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
test_exception('third division by zero for integers');
|
test_exception('third division by zero for integers');
|
||||||
exception_count:=0;
|
exception_count:=0;
|
||||||
|
level:=0;
|
||||||
for j:=1 to TestNumber do
|
for j:=1 to TestNumber do
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
i:=0;
|
i:=0;
|
||||||
|
inc(level);
|
||||||
e:=j/i;
|
e:=j/i;
|
||||||
except
|
except
|
||||||
on e : exception do
|
on e : exception do
|
||||||
begin
|
begin
|
||||||
inc(exception_count);
|
inc(exception_count);
|
||||||
|
if level>1 then
|
||||||
|
Writeln('exception overrun');
|
||||||
|
dec(level);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user