mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 10:39:18 +02:00
codetools: test for default property
git-svn-id: trunk@50079 -
This commit is contained in:
parent
b083361b7a
commit
1125a0b930
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1011,6 +1011,7 @@ components/codetools/tests/fpctests/tchlp53.pp svneol=native#text/plain
|
|||||||
components/codetools/tests/fpctests/tchlp6.pp svneol=native#text/plain
|
components/codetools/tests/fpctests/tchlp6.pp svneol=native#text/plain
|
||||||
components/codetools/tests/fpctests/tchlp7.pp svneol=native#text/plain
|
components/codetools/tests/fpctests/tchlp7.pp svneol=native#text/plain
|
||||||
components/codetools/tests/laztests/README.txt svneol=native#text/plain
|
components/codetools/tests/laztests/README.txt svneol=native#text/plain
|
||||||
|
components/codetools/tests/laztests/tdefaultproperty1.pas svneol=native#text/plain
|
||||||
components/codetools/tests/parsertbase.pas svneol=native#text/plain
|
components/codetools/tests/parsertbase.pas svneol=native#text/plain
|
||||||
components/codetools/tests/parsertest.lpi svneol=native#text/plain
|
components/codetools/tests/parsertest.lpi svneol=native#text/plain
|
||||||
components/codetools/tests/parsertest.lpr svneol=native#text/plain
|
components/codetools/tests/parsertest.lpr svneol=native#text/plain
|
||||||
|
@ -39,6 +39,7 @@ type
|
|||||||
TTestFindDeclaration = class(TTestCase)
|
TTestFindDeclaration = class(TTestCase)
|
||||||
private
|
private
|
||||||
procedure FindDeclarations(Filename: string);
|
procedure FindDeclarations(Filename: string);
|
||||||
|
procedure TestFiles(Directory: string);
|
||||||
published
|
published
|
||||||
procedure TestFindDeclaration_Basic;
|
procedure TestFindDeclaration_Basic;
|
||||||
procedure TestFindDeclaration_With;
|
procedure TestFindDeclaration_With;
|
||||||
@ -48,6 +49,7 @@ type
|
|||||||
procedure TestFindDeclaration_ObjCClass;
|
procedure TestFindDeclaration_ObjCClass;
|
||||||
procedure TestFindDeclaration_ObjCCategory;
|
procedure TestFindDeclaration_ObjCCategory;
|
||||||
procedure TestFindDeclaration_FPCTests;
|
procedure TestFindDeclaration_FPCTests;
|
||||||
|
procedure TestFindDeclaration_LazTests;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -236,6 +238,32 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TTestFindDeclaration.TestFiles(Directory: string);
|
||||||
|
const
|
||||||
|
fmparam = '--filemask=';
|
||||||
|
var
|
||||||
|
Info: TSearchRec;
|
||||||
|
aFilename, Param, aFileMask: String;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
aFileMask:='t*.p*';
|
||||||
|
for i:=1 to ParamCount do begin
|
||||||
|
Param:=ParamStr(i);
|
||||||
|
if LeftStr(Param,length(fmparam))=fmparam then
|
||||||
|
aFileMask:=copy(Param,length(fmparam)+1,100);
|
||||||
|
end;
|
||||||
|
Directory:=AppendPathDelim(Directory);
|
||||||
|
|
||||||
|
if FindFirstUTF8(Directory+aFileMask,faAnyFile,Info)=0 then begin
|
||||||
|
repeat
|
||||||
|
if faDirectory and Info.Attr>0 then continue;
|
||||||
|
aFilename:=Info.Name;
|
||||||
|
if not FilenameIsPascalUnit(aFilename) then continue;
|
||||||
|
FindDeclarations(Directory+aFilename);
|
||||||
|
until FindNextUTF8(Info)<>0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TTestFindDeclaration.TestFindDeclaration_Basic;
|
procedure TTestFindDeclaration.TestFindDeclaration_Basic;
|
||||||
begin
|
begin
|
||||||
FindDeclarations('fdt_basic.pas');
|
FindDeclarations('fdt_basic.pas');
|
||||||
@ -272,28 +300,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTestFindDeclaration.TestFindDeclaration_FPCTests;
|
procedure TTestFindDeclaration.TestFindDeclaration_FPCTests;
|
||||||
const
|
|
||||||
fmparam = '--filemask=';
|
|
||||||
var
|
|
||||||
Info: TSearchRec;
|
|
||||||
aFilename, Param, aFileMask: String;
|
|
||||||
i: Integer;
|
|
||||||
begin
|
begin
|
||||||
aFileMask:='t*.p*';
|
TestFiles('fpctests');
|
||||||
for i:=1 to ParamCount do begin
|
end;
|
||||||
Param:=ParamStr(i);
|
|
||||||
if LeftStr(Param,length(fmparam))=fmparam then
|
|
||||||
aFileMask:=copy(Param,length(fmparam)+1,100);
|
|
||||||
end;
|
|
||||||
|
|
||||||
if FindFirstUTF8('fpctests'+PathDelim+aFileMask,faAnyFile,Info)=0 then begin
|
procedure TTestFindDeclaration.TestFindDeclaration_LazTests;
|
||||||
repeat
|
begin
|
||||||
if faDirectory and Info.Attr>0 then continue;
|
TestFiles('laztests');
|
||||||
aFilename:=Info.Name;
|
|
||||||
if not FilenameIsPascalUnit(aFilename) then continue;
|
|
||||||
FindDeclarations('fpctests'+PathDelim+aFilename);
|
|
||||||
until FindNextUTF8(Info)<>0;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
36
components/codetools/tests/laztests/tdefaultproperty1.pas
Normal file
36
components/codetools/tests/laztests/tdefaultproperty1.pas
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
unit tdefaultproperty1;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
type
|
||||||
|
TNamedObj = class
|
||||||
|
public
|
||||||
|
Name: string;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TBaseObject }
|
||||||
|
|
||||||
|
TBaseObject = class
|
||||||
|
private
|
||||||
|
function GetObject(Index: Integer): TNamedObj;
|
||||||
|
public
|
||||||
|
property Objects[Index: Integer]: TNamedObj read GetObject; default;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{ TBaseObject }
|
||||||
|
|
||||||
|
function TBaseObject.GetObject(Index: Integer): TNamedObj;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
|
begin
|
||||||
|
Self.Objects{declaration:tdefaultproperty1.TBaseObject.Objects}[I].Name{declaration:tdefaultproperty1.TNamedObj.Name}:='';
|
||||||
|
Self[I].Name{declaration:tdefaultproperty1.TNamedObj.Name}:='';
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user