mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-11-04 14:49:34 +01:00 
			
		
		
		
	codetools: tests: added test for guessing type of default()
git-svn-id: trunk@55330 -
This commit is contained in:
		
							parent
							
								
									9ff73f8e2d
								
							
						
					
					
						commit
						f421cf15d7
					
				@ -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
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user