codetools: tests: added test for guessing type of default()

git-svn-id: trunk@55330 -
This commit is contained in:
mattias 2017-06-12 10:39:22 +00:00
parent 9ff73f8e2d
commit f421cf15d7
3 changed files with 10 additions and 6 deletions

View File

@ -9,6 +9,7 @@ procedure DoIt(s: string);
begin
i{guesstype:integer}:=length(s);
d{guesstype:string}:=copy(s,1,3);
i{guesstype:integer}:=default(integer);
end;
begin

View File

@ -106,7 +106,7 @@ implementation
procedure TCustomTestFindDeclaration.CheckReferenceMarkers;
var
i, FoundTopLine, FoundCleanPos: Integer;
i, FoundTopLine, FoundCleanPos, BlockTopLine, BlockBottomLine: Integer;
Marker, DeclMarker: TFDMarker;
CursorPos, FoundCursorPos: TCodeXYPosition;
FoundTool: TFindDeclarationTool;
@ -121,7 +121,8 @@ begin
// test FindDeclaration
if not CodeToolBoss.FindDeclaration(CursorPos.Code,CursorPos.X,CursorPos.Y,
FoundCursorPos.Code,FoundCursorPos.X,FoundCursorPos.Y,FoundTopLine)
FoundCursorPos.Code,FoundCursorPos.X,FoundCursorPos.Y,FoundTopLine,
BlockTopLine,BlockBottomLine)
then begin
WriteSource(CursorPos);
Fail('find declaration failed at '+MainTool.CleanPosToStr(Marker.NameStartPos,true)+': '+CodeToolBoss.ErrorMessage);
@ -195,7 +196,8 @@ var
FoundNode: TCodeTreeNode;
FoundPath: String;
Src: String;
NameStartPos, i, l, IdentifierStartPos, IdentifierEndPos: Integer;
NameStartPos, i, l, IdentifierStartPos, IdentifierEndPos,
BlockTopLine, BlockBottomLine: Integer;
Marker, ExpectedType, NewType: String;
IdentItem: TIdentifierListItem;
ItsAKeyword, IsSubIdentifier: boolean;
@ -268,7 +270,8 @@ begin
// test FindDeclaration
if not CodeToolBoss.FindDeclaration(CursorPos.Code,CursorPos.X,CursorPos.Y,
FoundCursorPos.Code,FoundCursorPos.X,FoundCursorPos.Y,FoundTopLine)
FoundCursorPos.Code,FoundCursorPos.X,FoundCursorPos.Y,FoundTopLine,
BlockTopLine,BlockBottomLine)
then begin
if ExpectedPath<>'' then begin
WriteSource(IdentifierStartPos);

View File

@ -71,14 +71,14 @@ procedure TTestCTMethodJumpTool.TestCTFindJumpPointIncFilewithIntfAndImpl;
NewCode: TCodeBuffer;
NewX: integer;
NewY: integer;
NewTopline: integer;
NewTopline, BlockTopLine, BlockBottomLine: integer;
RevertableJump: boolean;
begin
if not GetCTMarker(Code,StartMarker,BlockStart,LeftOfStart) then exit;
if not GetCTMarker(Code,EndMarker,BlockEnd,LeftOfEnd) then exit;
//debugln(['TTestCTStdCodetools.TestCTStdFindBlockStart BlockStart=',GetInfo(BlockStart),' BlockEnd=',GetInfo(BlockEnd)]);
if not CodeToolBoss.JumpToMethod(Code,BlockStart.X,BlockStart.Y,
NewCode,NewX,NewY,NewTopline,RevertableJump)
NewCode,NewX,NewY,NewTopline,BlockTopLine,BlockBottomLine,RevertableJump)
then
AssertEquals(aTitle+': '+CodeToolBoss.ErrorMessage,true,false)
else