mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 04:29:31 +02:00
* Tests for NAMESPACES directive
This commit is contained in:
parent
3b5fded2b3
commit
07fce04893
15
tests/test/nt.a.pp
Normal file
15
tests/test/nt.a.pp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
unit nt.a;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
Function GetIt : String;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
Function GetIt : String;
|
||||||
|
|
||||||
|
begin
|
||||||
|
getit:='a1';
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
15
tests/test/nt.nst.pp
Normal file
15
tests/test/nt.nst.pp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
unit nt.nst;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
Procedure HelloThere;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
Procedure HelloThere;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Writeln('Hello, there');
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
15
tests/test/nt2.a.pp
Normal file
15
tests/test/nt2.a.pp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
unit nt2.a;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
Function GetIt : String;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
Function GetIt : String;
|
||||||
|
|
||||||
|
begin
|
||||||
|
getit:='a2';
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
15
tests/test/nt2.nst2.pp
Normal file
15
tests/test/nt2.nst2.pp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
unit nt2.nst2;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
Procedure HelloThereToo;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
Procedure HelloThereToo;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Writeln('Hello, there too!');
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
7
tests/test/tnamesp.pp
Normal file
7
tests/test/tnamesp.pp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{$NAMESPACES nt}
|
||||||
|
|
||||||
|
uses nst;
|
||||||
|
|
||||||
|
begin
|
||||||
|
hellothere;
|
||||||
|
end.
|
8
tests/test/tnamesp2.pp
Normal file
8
tests/test/tnamesp2.pp
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{$NAMESPACES nt2,nt}
|
||||||
|
|
||||||
|
uses nst,nst2;
|
||||||
|
|
||||||
|
begin
|
||||||
|
hellothere;
|
||||||
|
hellothereToo;
|
||||||
|
end.
|
15
tests/test/tnamesp3.pp
Normal file
15
tests/test/tnamesp3.pp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// searched from last to first !
|
||||||
|
{$NAMESPACES nt2,nt}
|
||||||
|
|
||||||
|
uses a;
|
||||||
|
|
||||||
|
var
|
||||||
|
which : string;
|
||||||
|
begin
|
||||||
|
which:=GetIt;
|
||||||
|
if (which<>'a1') then
|
||||||
|
begin
|
||||||
|
Writeln('Wrong namespace used, expected a1, but got: ',which);
|
||||||
|
Halt(1);
|
||||||
|
end;
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user