codetools: test FindCodeContext with missing close bracket

git-svn-id: trunk@56516 -
This commit is contained in:
mattias 2017-11-27 21:52:57 +00:00
parent 5a96d17edc
commit 18a2d7544e

View File

@ -44,6 +44,7 @@ type
published
procedure Test_GetValuesOfCaseVariable_Enum;
procedure Test_FindCodeContext_ProcParams;
procedure Test_FindCodeContext_ProcParams_NoClosingBracket;
procedure Test_FindCodeContext_ProcTypeParams;
procedure Test_FindCodeContext_AttributeParams;
end;
@ -130,6 +131,40 @@ begin
end;
end;
procedure TTestIdentCompletion.Test_FindCodeContext_ProcParams_NoClosingBracket;
var
SrcMark: TFDMarker;
CursorPos: TCodeXYPosition;
CodeContexts: TCodeContextInfo;
begin
StartProgram;
Add([
'{#a}procedure DoIt(i, j: longint);',
'begin',
'end;',
'begin',
' DoIt({#c}',
'end.']);
ParseSimpleMarkers(Code);
SrcMark:=FindMarker('c','#');
AssertNotNull('missing src marker #c',SrcMark);
MainTool.CleanPosToCaret(SrcMark.CleanPos,CursorPos);
CodeContexts:=nil;
try
if not CodeToolBoss.FindCodeContext(Code,CursorPos.X,CursorPos.Y,CodeContexts)
then begin
WriteSource(CursorPos);
Fail('CodeToolBoss.FindCodeContext');
end;
AssertEquals('CodeContexts.Count',1,CodeContexts.Count);
//for i:=0 to CodeContexts.Count-1 do
// debugln(['TTestIdentCompletion.Test_FindCodeContext_ProcParams ',i,' ',CodeContexts[i].AsDebugString(true)]);
CheckCodeContext(CodeContexts[0],'a');
finally
CodeContexts.Free;
end;
end;
procedure TTestIdentCompletion.Test_FindCodeContext_ProcTypeParams;
var
SrcMark: TFDMarker;