* global properties

This commit is contained in:
peter 2003-12-10 16:32:19 +00:00
parent dce7bf35f9
commit a42f9109c0
2 changed files with 53 additions and 0 deletions

39
tests/test/tprop1.pp Normal file
View File

@ -0,0 +1,39 @@
{$mode fpc}
var
FErrno : longint;
function GetROVar:longint;
begin
GetROVar:=3;
end;
function GetErrno:longint;
begin
GetErrno:=FErrno;
end;
procedure SetErrno(e:longint);
begin
FErrno:=e;
end;
property
Errno:longint read GetErrno write SetErrno;
ROVar:longint read GetROVar;
begin
FErrno:=1;
if Errno<>1 then
begin
writeln('Error 1');
halt(1);
end;
Errno:=2;
if Errno<>2 then
begin
writeln('Error 2');
halt(1);
end;
if ROVar<>3 then
begin
writeln('Error 3');
halt(1);
end;
end.

14
tests/test/tprop2.pp Normal file
View File

@ -0,0 +1,14 @@
{ %fail }
{$mode fpc}
function GetROVar:longint;
begin
GetROVar:=3;
end;
property
ROVar:longint read GetROVar;
begin
ROVar:=1;
end.