codetools: added test for complete method with specialize param

git-svn-id: trunk@56318 -
This commit is contained in:
mattias 2017-11-06 13:06:48 +00:00
parent c8498f15df
commit 5a24b63f1f

View File

@ -19,6 +19,7 @@ type
Expected: array of string);
published
procedure TestIntfProcUpdateArgName;
procedure TestCompleteMethodBody_ParamSpecialize;
end;
implementation
@ -41,7 +42,13 @@ begin
if not CodeToolBoss.CompleteCode(Code,Col,Line,Line,NewCode,NewX,NewY,NewTopLine,
BlockTopLine,BlockBottomLine,false) then
begin
WriteSource(Code.Filename,Line,Col);
NewY:=Line;
NewX:=Col;
if CodeToolBoss.ErrorLine>0 then begin
NewY:=CodeToolBoss.ErrorLine;
NewX:=CodeToolBoss.ErrorColumn;
end;
WriteSource(Code.Filename,NewY,NewX);
Fail(Title+'call CompleteCode failed: '+CodeToolBoss.ErrorDbgMsg);
end;
s:='';
@ -70,6 +77,38 @@ begin
,'end.']);
end;
procedure TTestCodeCompletion.TestCompleteMethodBody_ParamSpecialize;
begin
Test('TestCompleteMethodBody_ParamSpecialize',
['unit test1;',
'{$mode objfpc}{$H+}',
'interface',
'type',
' TBird = class',
' procedure DoIt(i: specialize TGenList<longint>);',
' end;',
'implementation',
'end.'],
6,1,
['unit test1;',
'{$mode objfpc}{$H+}',
'interface',
'type',
'',
' { TBird }',
'',
' TBird = class',
' procedure DoIt(i: specialize TGenList<longint>);',
' end;',
'implementation',
'',
'procedure TBird.DoIt(i: specialize TGenList<longint>);',
'begin',
'end;',
'',
'end.']);
end;
initialization
RegisterTests([TTestCodeCompletion]);
end.