codetools: added tests bug #28866

git-svn-id: trunk@50086 -
This commit is contained in:
mattias 2015-10-16 21:37:22 +00:00
parent 174015662d
commit 4245b8129c
4 changed files with 75 additions and 1 deletions

2
.gitattributes vendored
View File

@ -1013,6 +1013,8 @@ components/codetools/tests/fpctests/tchlp7.pp svneol=native#text/plain
components/codetools/tests/laztests/README.txt svneol=native#text/plain
components/codetools/tests/laztests/bug28861_unit1.pas svneol=native#text/plain
components/codetools/tests/laztests/bug28861_unit2.pas svneol=native#text/plain
components/codetools/tests/laztests/bug28866_prg.pas svneol=native#text/plain
components/codetools/tests/laztests/bug28866_unit1.pas 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/parsertest.lpi svneol=native#text/plain

View File

@ -40,7 +40,7 @@
<PackageName Value="fpcunitconsolerunner"/>
</Item2>
</RequiredPackages>
<Units Count="11">
<Units Count="13">
<Unit0>
<Filename Value="finddeclarationtest.lpr"/>
<IsPartOfProject Value="True"/>
@ -85,6 +85,14 @@
<Filename Value="fpctests/README.txt"/>
<IsPartOfProject Value="True"/>
</Unit10>
<Unit11>
<Filename Value="laztests/bug28866_prg.pas"/>
<IsPartOfProject Value="True"/>
</Unit11>
<Unit12>
<Filename Value="laztests/bug28866_unit1.pas"/>
<IsPartOfProject Value="True"/>
</Unit12>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -0,0 +1,15 @@
program bug28866_prg;
{$mode objfpc}{$H+}
uses
bug28866_unit1;
var
S: String;
O: TObject;
begin
S.Twice{declaration:bug28866_unit1.TStringHelper.Twice};
O.Test{declaration:bug28866_unit1.TObjectHelper.Test};
end.

View File

@ -0,0 +1,49 @@
unit bug28866_unit1;
{$mode delphi}
interface
{ TStringHelper }
type
TStringHelper = record helper for string
private
function GetTheLength: Integer;
public
function Twice: string;
function Thrice: string;
property TheLength: Integer read GetTheLength;
end;
TObjectHelper = class helper for TObject
public
function Test: Integer;
end;
implementation
{ TObjectHelper }
function TObjectHelper.Test: Integer;
begin
end;
function TStringHelper.GetTheLength: Integer;
begin
Result := Length(Self)
end;
function TStringHelper.Twice: string;
begin
Result := Self + Self;
end;
function TStringHelper.Thrice: string;
begin
Result := Self + Self + Self;
end;
end.