mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 00:02:03 +02:00
tests: compile to units/targetcpu-targetos, added codetools test for modified initialization section
git-svn-id: trunk@30176 -
This commit is contained in:
parent
db3dd549ff
commit
ce19f7ed35
@ -24,6 +24,8 @@ type
|
||||
crsfWithProc1Modified,
|
||||
crsfWithCommentAtEnd,
|
||||
crsfWithInitialization,
|
||||
crsfWithInitializationStatement1,
|
||||
crsfWithInitializationStatement2,
|
||||
crsfWithFinalization
|
||||
);
|
||||
TCTRgSrcFlags = set of TCTRgSrcFlag;
|
||||
@ -39,6 +41,7 @@ type
|
||||
procedure TestCTScanRangeDescending;
|
||||
procedure TestCTScanRangeProcModified;
|
||||
procedure TestCTScanRangeImplementationToEnd;
|
||||
procedure TestCTScanRangeInitializationModified;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -66,8 +69,13 @@ begin
|
||||
+'begin'+LineEnding
|
||||
+' // comment'+LineEnding
|
||||
+'end;'+LineEnding;
|
||||
if crsfWithInitialization in Flags then
|
||||
if crsfWithInitialization in Flags then begin
|
||||
Result:=Result+'initialization'+LineEnding;
|
||||
if crsfWithInitializationStatement1 in Flags then
|
||||
Result:=Result+'i:=3;'+LineEnding;
|
||||
if crsfWithInitializationStatement2 in Flags then
|
||||
Result:=Result+'i:=5;'+LineEnding;
|
||||
end;
|
||||
if crsfWithFinalization in Flags then
|
||||
Result:=Result+'finalization'+LineEnding;
|
||||
Result:=Result+'end.';
|
||||
@ -190,6 +198,8 @@ begin
|
||||
Tool:=CodeToolBoss.GetCodeToolForSource(Code,false,true) as TCodeTool;
|
||||
|
||||
// scan source
|
||||
Code.Source:='begin end.';
|
||||
Tool.BuildTree(lsrEnd);
|
||||
Code.Source:=GetSource([]);
|
||||
MinRange:=low(TLinkScannerRange);
|
||||
MaxRange:=high(TLinkScannerRange);
|
||||
@ -237,14 +247,34 @@ begin
|
||||
// scan source
|
||||
Code.Source:=GetSource([crsfWithProc1]);
|
||||
Tool.BuildTree(lsrImplementationStart);
|
||||
Tool.WriteDebugTreeReport;
|
||||
//Tool.WriteDebugTreeReport;
|
||||
AssertEquals('step1: implementation found',true,Tool.FindImplementationNode<>nil);
|
||||
|
||||
Tool.BuildTree(lsrEnd);
|
||||
Tool.WriteDebugTreeReport;
|
||||
//Tool.WriteDebugTreeReport;
|
||||
AssertEquals('step2: end. found',true,Tool.Tree.FindRootNode(ctnEndPoint)<>nil);
|
||||
end;
|
||||
|
||||
procedure TTestCodetoolsRangeScan.TestCTScanRangeInitializationModified;
|
||||
var
|
||||
Code: TCodeBuffer;
|
||||
Tool: TCodeTool;
|
||||
begin
|
||||
Code:=CodeToolBoss.CreateFile('TestRangeScan.pas');
|
||||
Tool:=CodeToolBoss.GetCodeToolForSource(Code,false,true) as TCodeTool;
|
||||
|
||||
// scan source with initialization
|
||||
Code.Source:=GetSource([crsfWithInitialization,crsfWithInitializationStatement1]);
|
||||
Tool.BuildTree(lsrEnd);
|
||||
AssertEquals('step1: end found',true,Tool.Tree.FindRootNode(ctnEndPoint)<>nil);
|
||||
|
||||
// scan source with a modified initialization
|
||||
Code.Source:=GetSource([crsfWithInitialization,crsfWithInitializationStatement2]);
|
||||
Tool.BuildTree(lsrEnd);
|
||||
AssertEquals('step2: end found',true,Tool.Tree.FindRootNode(ctnEndPoint)<>nil);
|
||||
//Tool.WriteDebugTreeReport;
|
||||
end;
|
||||
|
||||
initialization
|
||||
AddToCodetoolsTestSuite(TTestCodetoolsRangeScan);
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<AlwaysBuild Value="False"/>
|
||||
<LRSInOutputDirectory Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InIDEConfig"/>
|
||||
@ -23,7 +22,7 @@
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="4">
|
||||
@ -104,10 +103,14 @@
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="9"/>
|
||||
<Version Value="10"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="runtestsgui"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value="bugs;codetoolstests;lcltests;semiauto"/>
|
||||
<UnitOutputDirectory Value="units\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
@ -121,6 +124,9 @@
|
||||
</Debugging>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<UseMsgFile Value="True"/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
|
Loading…
Reference in New Issue
Block a user