mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 12:39:09 +02:00
added test cases for comming macpas features
git-svn-id: trunk@2302 -
This commit is contained in:
parent
dadbbb32ce
commit
58f59b9134
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -5622,6 +5622,9 @@ tests/test/tintuint.pp svneol=native#text/plain
|
|||||||
tests/test/tlibrary1.pp svneol=native#text/plain
|
tests/test/tlibrary1.pp svneol=native#text/plain
|
||||||
tests/test/tlibrary2.pp svneol=native#text/plain
|
tests/test/tlibrary2.pp svneol=native#text/plain
|
||||||
tests/test/tmacfunret.pp svneol=native#text/plain
|
tests/test/tmacfunret.pp svneol=native#text/plain
|
||||||
|
tests/test/tmaclocalprocparam.pp svneol=native#text/plain
|
||||||
|
tests/test/tmacnonlocalexit.pp svneol=native#text/plain
|
||||||
|
tests/test/tmacnonlocalgoto.pp svneol=native#text/plain
|
||||||
tests/test/tmacpas1.pp svneol=native#text/plain
|
tests/test/tmacpas1.pp svneol=native#text/plain
|
||||||
tests/test/tmacpas2.pp svneol=native#text/plain
|
tests/test/tmacpas2.pp svneol=native#text/plain
|
||||||
tests/test/tmacpas3.pp svneol=native#text/plain
|
tests/test/tmacpas3.pp svneol=native#text/plain
|
||||||
|
43
tests/test/tmaclocalprocparam.pp
Normal file
43
tests/test/tmaclocalprocparam.pp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
program tmaclocalprocparam;
|
||||||
|
{$MODE MACPAS}
|
||||||
|
|
||||||
|
var
|
||||||
|
failed: Boolean;
|
||||||
|
|
||||||
|
|
||||||
|
procedure Outside (procedure P);
|
||||||
|
begin
|
||||||
|
P;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure Global;
|
||||||
|
|
||||||
|
var
|
||||||
|
nonlocalvar: integer;
|
||||||
|
|
||||||
|
procedure Local;
|
||||||
|
begin
|
||||||
|
nonlocalvar := 42;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
nonlocalvar := 24;
|
||||||
|
Outside(Local);
|
||||||
|
failed := (nonlocalvar <> 42);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
begin
|
||||||
|
Global;
|
||||||
|
|
||||||
|
if failed then
|
||||||
|
writeln('Failed')
|
||||||
|
else
|
||||||
|
writeln('Succeded');
|
||||||
|
|
||||||
|
{$IFC UNDEFINED THINK_Pascal}
|
||||||
|
if failed then
|
||||||
|
Halt(1);
|
||||||
|
{$ENDC}
|
||||||
|
end.
|
35
tests/test/tmacnonlocalexit.pp
Normal file
35
tests/test/tmacnonlocalexit.pp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
program tmacnonlocalexit;
|
||||||
|
{$MODE MACPAS}
|
||||||
|
|
||||||
|
var
|
||||||
|
failed: Boolean;
|
||||||
|
|
||||||
|
procedure Global;
|
||||||
|
|
||||||
|
procedure Local;
|
||||||
|
begin
|
||||||
|
Exit(Global);
|
||||||
|
failed := true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Local;
|
||||||
|
failed := true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
begin
|
||||||
|
failed := false;
|
||||||
|
|
||||||
|
Global;
|
||||||
|
|
||||||
|
if failed then
|
||||||
|
writeln('Failed')
|
||||||
|
else
|
||||||
|
writeln('Succeded');
|
||||||
|
|
||||||
|
{$IFC NOT UNDEFINED FPC}
|
||||||
|
if failed then
|
||||||
|
Halt(1);
|
||||||
|
{$ENDC}
|
||||||
|
end.
|
38
tests/test/tmacnonlocalgoto.pp
Normal file
38
tests/test/tmacnonlocalgoto.pp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
program tmacnonlocalgoto;
|
||||||
|
{$MODE MACPAS}
|
||||||
|
|
||||||
|
label
|
||||||
|
1;
|
||||||
|
|
||||||
|
var
|
||||||
|
failed: Boolean;
|
||||||
|
|
||||||
|
procedure Global;
|
||||||
|
|
||||||
|
procedure Local;
|
||||||
|
begin
|
||||||
|
goto 1;
|
||||||
|
failed := true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Local;
|
||||||
|
failed := true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
begin
|
||||||
|
failed := false;
|
||||||
|
|
||||||
|
Global;
|
||||||
|
1:
|
||||||
|
if failed then
|
||||||
|
writeln('Failed')
|
||||||
|
else
|
||||||
|
writeln('Succeded');
|
||||||
|
|
||||||
|
{$IFC NOT UNDEFINED FPC}
|
||||||
|
if failed then
|
||||||
|
Halt(1);
|
||||||
|
{$ENDC}
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user