mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 06:09:14 +02:00
codetools: test uses vs local precedence
This commit is contained in:
parent
fe0820345d
commit
c92a49b9f9
@ -163,7 +163,10 @@ type
|
|||||||
procedure TestFindDeclaration_FindFPCSrcNameSpacedUnits;
|
procedure TestFindDeclaration_FindFPCSrcNameSpacedUnits;
|
||||||
|
|
||||||
// unit namespaces
|
// unit namespaces
|
||||||
procedure TestFindDeclaration_LocalBeforeUses;
|
procedure TestFindDeclaration_ProgLocalVsUses;
|
||||||
|
procedure TestFindDeclaration_UnitIntfVsUses;
|
||||||
|
procedure TestFindDeclaration_UnitImplVsIntfUses;
|
||||||
|
procedure TestFindDeclaration_UnitImplVsImplUses;
|
||||||
|
|
||||||
// directives
|
// directives
|
||||||
procedure TestFindDeclaration_DirectiveWithIn;
|
procedure TestFindDeclaration_DirectiveWithIn;
|
||||||
@ -1727,7 +1730,7 @@ begin
|
|||||||
Traverse(FPCSrcDir,0,-1);
|
Traverse(FPCSrcDir,0,-1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTestFindDeclaration.TestFindDeclaration_LocalBeforeUses;
|
procedure TTestFindDeclaration.TestFindDeclaration_ProgLocalVsUses;
|
||||||
var
|
var
|
||||||
DotsUnit: TCodeBuffer;
|
DotsUnit: TCodeBuffer;
|
||||||
begin
|
begin
|
||||||
@ -1736,6 +1739,7 @@ begin
|
|||||||
DotsUnit:=CodeToolBoss.CreateFile('nsA.dots.pp');
|
DotsUnit:=CodeToolBoss.CreateFile('nsA.dots.pp');
|
||||||
DotsUnit.Source:='unit nsa.dots;'+LineEnding
|
DotsUnit.Source:='unit nsa.dots;'+LineEnding
|
||||||
+'interface'+LineEnding
|
+'interface'+LineEnding
|
||||||
|
+'type Size = word;'+LineEnding
|
||||||
+'implementation'+LineEnding
|
+'implementation'+LineEnding
|
||||||
+'end.';
|
+'end.';
|
||||||
|
|
||||||
@ -1761,6 +1765,114 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TTestFindDeclaration.TestFindDeclaration_UnitIntfVsUses;
|
||||||
|
var
|
||||||
|
DotsUnit: TCodeBuffer;
|
||||||
|
begin
|
||||||
|
DotsUnit:=nil;
|
||||||
|
try
|
||||||
|
DotsUnit:=CodeToolBoss.CreateFile('nsA.dots.pp');
|
||||||
|
DotsUnit.Source:='unit nsa.dots;'+LineEnding
|
||||||
|
+'interface'+LineEnding
|
||||||
|
+'type Size = word;'+LineEnding
|
||||||
|
+'implementation'+LineEnding
|
||||||
|
+'end.';
|
||||||
|
|
||||||
|
StartUnit;
|
||||||
|
Add([
|
||||||
|
'uses nsA.dots;',
|
||||||
|
'type',
|
||||||
|
' TWing = record',
|
||||||
|
' Size: word;',
|
||||||
|
' end;',
|
||||||
|
' TBird = record',
|
||||||
|
' DoTs: TWing;',
|
||||||
|
' end;',
|
||||||
|
'var NSA: TBird;',
|
||||||
|
'implementation',
|
||||||
|
'begin',
|
||||||
|
' NSA.dots.Size{declaration:test1.twing.Size}:=3',
|
||||||
|
'end.',
|
||||||
|
'']);
|
||||||
|
FindDeclarations(Code);
|
||||||
|
finally
|
||||||
|
if DotsUnit<>nil then
|
||||||
|
DotsUnit.IsDeleted:=true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTestFindDeclaration.TestFindDeclaration_UnitImplVsIntfUses;
|
||||||
|
var
|
||||||
|
DotsUnit: TCodeBuffer;
|
||||||
|
begin
|
||||||
|
DotsUnit:=nil;
|
||||||
|
try
|
||||||
|
DotsUnit:=CodeToolBoss.CreateFile('nsA.dots.pp');
|
||||||
|
DotsUnit.Source:='unit nsa.dots;'+LineEnding
|
||||||
|
+'interface'+LineEnding
|
||||||
|
+'type Size = word;'+LineEnding
|
||||||
|
+'implementation'+LineEnding
|
||||||
|
+'end.';
|
||||||
|
|
||||||
|
StartUnit;
|
||||||
|
Add([
|
||||||
|
'uses nsA.dots;',
|
||||||
|
'implementation',
|
||||||
|
'type',
|
||||||
|
' TWing = record',
|
||||||
|
' Size: word;',
|
||||||
|
' end;',
|
||||||
|
' TBird = record',
|
||||||
|
' DoTs: TWing;',
|
||||||
|
' end;',
|
||||||
|
'var NSA: TBird;',
|
||||||
|
'begin',
|
||||||
|
' NSA.dots.Size{declaration:twing.Size}:=3',
|
||||||
|
'end.',
|
||||||
|
'']);
|
||||||
|
FindDeclarations(Code);
|
||||||
|
finally
|
||||||
|
if DotsUnit<>nil then
|
||||||
|
DotsUnit.IsDeleted:=true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTestFindDeclaration.TestFindDeclaration_UnitImplVsImplUses;
|
||||||
|
var
|
||||||
|
DotsUnit: TCodeBuffer;
|
||||||
|
begin
|
||||||
|
DotsUnit:=nil;
|
||||||
|
try
|
||||||
|
DotsUnit:=CodeToolBoss.CreateFile('nsA.dots.pp');
|
||||||
|
DotsUnit.Source:='unit nsa.dots;'+LineEnding
|
||||||
|
+'interface'+LineEnding
|
||||||
|
+'type Size = word;'+LineEnding
|
||||||
|
+'implementation'+LineEnding
|
||||||
|
+'end.';
|
||||||
|
|
||||||
|
StartUnit;
|
||||||
|
Add([
|
||||||
|
'implementation',
|
||||||
|
'uses nsA.dots;',
|
||||||
|
'type',
|
||||||
|
' TWing = record',
|
||||||
|
' Size: word;',
|
||||||
|
' end;',
|
||||||
|
' TBird = record',
|
||||||
|
' DoTs: TWing;',
|
||||||
|
' end;',
|
||||||
|
'var NSA: TBird;',
|
||||||
|
'begin',
|
||||||
|
' NSA.dots.Size{declaration:twing.Size}:=3',
|
||||||
|
'end.',
|
||||||
|
'']);
|
||||||
|
FindDeclarations(Code);
|
||||||
|
finally
|
||||||
|
if DotsUnit<>nil then
|
||||||
|
DotsUnit.IsDeleted:=true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TTestFindDeclaration.TestFindDeclaration_DirectiveWithIn;
|
procedure TTestFindDeclaration.TestFindDeclaration_DirectiveWithIn;
|
||||||
begin
|
begin
|
||||||
StartProgram;
|
StartProgram;
|
||||||
|
Loading…
Reference in New Issue
Block a user