tests: started test for codetools range scan

git-svn-id: trunk@29747 -
This commit is contained in:
mattias 2011-03-07 23:21:08 +00:00
parent ae13b849e4
commit bb74af971c
4 changed files with 76 additions and 2 deletions

1
.gitattributes vendored
View File

@ -5757,6 +5757,7 @@ test/bugs/testfileutil.pas svneol=native#text/plain
test/bugtestcase.pas svneol=native#text/plain
test/codetoolstests/testbasiccodetools.pas svneol=native#text/plain
test/codetoolstests/testcompleteblock.pas svneol=native#text/plain
test/codetoolstests/testctrangescan.pas svneol=native#text/plain
test/codetoolstests/testctxmlfixfragments.pas svneol=native#text/pascal
test/hello.ahk svneol=native#text/plain
test/lcltests/testpen.pas svneol=native#text/plain

View File

@ -0,0 +1,60 @@
{
Test with:
./runtests --format=plain --suite=TestCTScanRange
}
unit TestCTRangeScan;
{$mode objfpc}{$H+}
interface
{$IFNDEF EnableCTRange}
implementation
end.
{$ENDIF}
uses
Classes, SysUtils, fpcunit, testglobals,
CodeToolManager, CodeCache, CustomCodeTool, LinkScanner;
type
{ TTestCodetoolsRangeScan }
TTestCodetoolsRangeScan = class(TTestCase)
protected
published
procedure TestCTScanRange;
end;
implementation
{ TTestCodetoolsRangeScan }
procedure TTestCodetoolsRangeScan.TestCTScanRange;
var
Code: TCodeBuffer;
Tool: TCodeTool;
begin
Code:=CodeToolBoss.CreateFile('TestRangeScan.pas');
Code.Source:=
'unit TestRangeScan;'+LineEnding
+'interface'+LineEnding
+'uses'+LineEnding
+' Classes;'+LineEnding
+'var i: integer;'+LineEnding
+'implementation'+LineEnding
+'uses'+LineEnding
+' Math;'+LineEnding
+'const c = 3;'+LineEnding
+'end.';
Tool:=CodeToolBoss.GetCodeToolForSource(Code,false,true) as TCodeTool;
Tool.BuildTree(lsrInitializationStart);
Tool.WriteDebugTreeReport;
end;
initialization
AddToCodetoolsTestSuite(TTestCodetoolsRangeScan);
end.

View File

@ -39,7 +39,7 @@
<PackageName Value="LCL"/>
</Item4>
</RequiredPackages>
<Units Count="11">
<Units Count="12">
<Unit0>
<Filename Value="runtests.lpr"/>
<IsPartOfProject Value="True"/>
@ -95,6 +95,11 @@
<IsPartOfProject Value="True"/>
<UnitName Value="TestCTXMLFixFragments"/>
</Unit10>
<Unit11>
<Filename Value="codetoolstests\testctrangescan.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="TestCTRangeScan"/>
</Unit11>
</Units>
</ProjectOptions>
<CompilerOptions>
@ -103,6 +108,14 @@
<SearchPaths>
<OtherUnitFiles Value="bugs;lcltests;codetoolstests"/>
</SearchPaths>
<Conditionals Value="if defined(EnableCTRange) then
CustomOptions += '-dEnableCTRange';"/>
<BuildMacros>
<Count Value="1"/>
<Item1>
<Identifier Value="EnableCTRange"/>
</Item1>
</BuildMacros>
<Parsing>
<SyntaxOptions>
<CStyleOperator Value="False"/>

View File

@ -24,7 +24,7 @@ uses
Classes, consoletestrunner,
testglobals, testunits, dom,
{Unit needed to set the LCL version and widget set name}
LCLVersion, InterfaceBase, Interfaces, TestCTXMLFixFragments;
LCLVersion, InterfaceBase, Interfaces, TestCTXMLFixFragments, TestCTRangeScan;
type