mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 20:38:08 +02:00
tests: codetools completeblock: added test results
git-svn-id: trunk@21342 -
This commit is contained in:
parent
d86f3e5aec
commit
0fcb8b8adb
13
.gitattributes
vendored
13
.gitattributes
vendored
@ -162,20 +162,33 @@ components/codetools/examples/scanexamples/wrongforwarddefinitions.pas svneol=na
|
||||
components/codetools/examples/setincludepath.lpi svneol=native#text/plain
|
||||
components/codetools/examples/setincludepath.pas svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/beginwithoutindent1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/beginwithoutindent1_result1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/beginwithoutindent1_result2.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/casecolon1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/casecolon1_result.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/caseelseend1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/caseelseend1_result.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/caseend1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/caseend1_result.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/class1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/class1_result.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/ifbegin1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/ifbegin1_result.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/ifbeginelse1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/ifbeginelse1_result.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/procedurebegin1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/procedurebegin1_result.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/procedurebeginend1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/procedurebeginend1_result.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/procedurebeginifbegin1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/procedurebeginifbegin1_result.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/record1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/record1_result1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/repeatifelse1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/repeatifelse1_result.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/unit1.pas svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/whilebegin1.inc svneol=native#text/plain
|
||||
components/codetools/examples/testscompleteblock/whilebegin1_result.inc svneol=native#text/plain
|
||||
components/codetools/expreval.pas svneol=native#text/pascal
|
||||
components/codetools/extractproctool.pas svneol=native#text/pascal
|
||||
components/codetools/fileprocs.pas svneol=native#text/pascal
|
||||
|
@ -0,0 +1,11 @@
|
||||
{%MainUnit unit1.pas}
|
||||
procedure Do1;
|
||||
begin
|
||||
if true then begin
|
||||
aa;
|
||||
|
||||
xx
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
{%MainUnit unit1.pas}
|
||||
procedure Do1;
|
||||
begin
|
||||
if true then begin
|
||||
aa;
|
||||
|
||||
xx
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
{%MainUnit unit1.pas}
|
||||
procedure Do1;
|
||||
begin
|
||||
case i of
|
||||
1: ;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
{%MainUnit unit1.pas}
|
||||
procedure Do1;
|
||||
begin
|
||||
case i of
|
||||
else
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
{%MainUnit unit1.pas}
|
||||
procedure Do1;
|
||||
begin
|
||||
case i of
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
{%MainUnit unit1.pas}
|
||||
type
|
||||
TMyClass = class
|
||||
end;
|
||||
|
||||
|
||||
procedure Do1;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
{%MainUnit unit1.pas}
|
||||
procedure Do1;
|
||||
begin
|
||||
if expr then begin
|
||||
end;
|
||||
code;
|
||||
end;
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
{%MainUnit unit1.pas}
|
||||
procedure Do1;
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure Do2;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
|
@ -0,0 +1,15 @@
|
||||
{%MainUnit unit1.pas}
|
||||
procedure Do1;
|
||||
begin
|
||||
Code;
|
||||
|
||||
Code;
|
||||
|
||||
end;
|
||||
|
||||
procedure Do2;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
{%MainUnit unit1.pas}
|
||||
procedure Do1;
|
||||
procedure BeginBlock(Typ: TFABBlockType);
|
||||
var
|
||||
ParentBlock: PBlock;
|
||||
begin
|
||||
if (Stack.Top>=0) then begin
|
||||
ParentBlock:=@Stack.Stack[Stack.Top];
|
||||
if (ParentBlock^.InnerStartPos=AtomStart)
|
||||
and (Policies<>nil) then begin
|
||||
Policies.AddIndent(ParentBlock^.Typ,Typ,ParentBlock^.InnerIdent);
|
||||
end;
|
||||
end;
|
||||
Stack.BeginBlock(Typ,AtomStart);
|
||||
{$IFDEF ShowCodeBeautifierParser}
|
||||
DebugLn([GetIndentStr(Stack.Top*2),'BeginBlock ',FABBlockTypeNames[Typ],' ',GetAtomString(@Src[AtomStart],NestedComments),' at ',PosToStr(p)]);
|
||||
{$ENDIF}
|
||||
end;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
|
@ -0,0 +1,12 @@
|
||||
{%MainUnit unit1.pas}
|
||||
type
|
||||
TMyRecord1 = record
|
||||
end;
|
||||
|
||||
PMyRecord1 = ^TMyRecord1;
|
||||
|
||||
procedure Do1;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
{%MainUnit unit1.pas}
|
||||
procedure Do1;
|
||||
var
|
||||
FileInfo: TSearchRec;
|
||||
begin
|
||||
if FindFirstUTF8(Dir+FileMask,faAnyFile,FileInfo)=0 then begin
|
||||
repeat
|
||||
// check if special file
|
||||
if (FileInfo.Name='.') or (FileInfo.Name='..') or (FileInfo.Name='')
|
||||
then
|
||||
continue;
|
||||
|
||||
if FilenameIsPascalUnit(FileInfo.Name,false) then begin
|
||||
List.Add(Dir+FileInfo.Name);
|
||||
end else if (FileInfo.Attr and faDirectory)>0 then begin
|
||||
CollectUnits(Dir+);
|
||||
end;
|
||||
until FindNextUTF8(FileInfo)<>0;
|
||||
end;
|
||||
FindCloseUTF8(FileInfo);
|
||||
end;
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
{%MainUnit unit1.pas}
|
||||
procedure Do1;
|
||||
begin
|
||||
while true do
|
||||
begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -47,7 +47,21 @@ end;
|
||||
|
||||
procedure TCodeBlocksTest.TestCompleteBlocks;
|
||||
begin
|
||||
CompareComplete('ifbeginelse1.inc','6 28 ifbeginelse fpcunit', 'ifbeginelse1.result');
|
||||
CompareComplete('ifbeginelse1.inc','6 28 ifbeginelse fpcunit', 'ifbeginelse1_result.inc');
|
||||
CompareComplete('whilebegin1.inc','5 10 whilebegin fpcunit', 'whilebegin1_result.inc');
|
||||
CompareComplete('beginwithoutindent1.inc','4 21 beginwithoutindent fpcunit', 'beginwithoutindent1_result1.inc');
|
||||
CompareComplete('beginwithoutindent1.inc','5 6 beginwithoutindent fpcunit', 'beginwithoutindent1_result2.inc');
|
||||
CompareComplete('casecolon1.inc','5 5 casecolon fpcunit', 'casecolon1_result.inc');
|
||||
CompareComplete('caseelseend1.inc','5 7 caseelseend fpcunit', 'caseelseend1_result.inc');
|
||||
CompareComplete('caseend1.inc','4 12 caseend fpcunit', 'caseend1_result.inc');
|
||||
CompareComplete('class1.inc','3 19 class fpcunit', 'class1_result.inc');
|
||||
CompareComplete('ifbegin1.inc','4 21 ifbegin fpcunit', 'ifbegin1_result.inc');
|
||||
CompareComplete('ifbeginelse1.inc','6 28 ifbeginelse fpcunit', 'ifbeginelse1_result.inc');
|
||||
CompareComplete('procedurebegin1.inc','3 6 procedurebegin fpcunit', 'procedurebegin1_result.inc');
|
||||
CompareComplete('procedurebeginend1.inc','4 8 procedurebeginend fpcunit', 'procedurebeginend1_result.inc');
|
||||
CompareComplete('procedurebeginifbegin1.inc','11 74 procedurebeginifbegin fpcunit', 'procedurebeginifbegin1_result.inc');
|
||||
CompareComplete('record1.inc','3 22 record fpcunit', 'record1_result1.inc');
|
||||
CompareComplete('repeatifelse1.inc','11 18 repeatifelse fpcunit', 'repeatifelse1_result.inc');
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user