mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-21 03:29:19 +02:00
+ Removed helper function. Indentation should not be a global variable
git-svn-id: trunk@5025 -
This commit is contained in:
parent
afbd50967c
commit
4625cb9c16
@ -53,6 +53,7 @@ type
|
|||||||
procedure EndTest(ATest: TTest);
|
procedure EndTest(ATest: TTest);
|
||||||
end;}
|
end;}
|
||||||
|
|
||||||
|
function TestSuiteAsXML(aSuite:TTestSuite; Indent : Integer): string;
|
||||||
function TestSuiteAsXML(aSuite: TTestSuite): string;
|
function TestSuiteAsXML(aSuite: TTestSuite): string;
|
||||||
function TestSuiteAsLatex(aSuite:TTestSuite): string;
|
function TestSuiteAsLatex(aSuite:TTestSuite): string;
|
||||||
function TestSuiteAsPlain(aSuite:TTestSuite): string;
|
function TestSuiteAsPlain(aSuite:TTestSuite): string;
|
||||||
@ -64,23 +65,6 @@ function TestResultAsPlain(aTestResult: TTestResult): string;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
var
|
|
||||||
uLevel: integer; // indentation counter
|
|
||||||
|
|
||||||
|
|
||||||
// Helper function: Return a string of spaces pIntLen long
|
|
||||||
function trSpace(pIntLen: integer): string;
|
|
||||||
var
|
|
||||||
i: integer;
|
|
||||||
sString: string;
|
|
||||||
begin
|
|
||||||
sString := '';
|
|
||||||
for i := 1 to pIntLen do
|
|
||||||
sString := sString + ' ';
|
|
||||||
Result := sString;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{TXMLResultsWriter}
|
{TXMLResultsWriter}
|
||||||
procedure TXMLResultsWriter.WriteHeader;
|
procedure TXMLResultsWriter.WriteHeader;
|
||||||
begin
|
begin
|
||||||
@ -156,21 +140,27 @@ begin
|
|||||||
writeln;
|
writeln;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TestSuiteAsXML(aSuite:TTestSuite): string;
|
function TestSuiteAsXML(aSuite:TTestSuite): string;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:=TestSuiteAsXML(ASuite,0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TestSuiteAsXML(aSuite:TTestSuite; Indent : Integer): string;
|
||||||
|
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
Result := trSpace(uLevel) + '<TestSuite name="' + ASuite.TestName + '">' + System.sLineBreak;
|
Result := StringOfChar(' ',Indent) + '<TestSuite name="' + ASuite.TestName + '">' + System.sLineBreak;
|
||||||
Inc(uLevel, 2);
|
Inc(Indent, 2);
|
||||||
for i := 0 to aSuite.Tests.Count - 1 do
|
for i := 0 to aSuite.Tests.Count - 1 do
|
||||||
if TTest(aSuite.Tests.Items[i]) is TTestSuite then
|
if TTest(aSuite.Tests.Items[i]) is TTestSuite then
|
||||||
Result := Result + TestSuiteAsXML(TTestSuite(aSuite.Tests.Items[i]))
|
Result := Result + TestSuiteAsXML(TTestSuite(aSuite.Tests.Items[i]),Indent)
|
||||||
else
|
else
|
||||||
if TTest(aSuite.Tests.Items[i]) is TTestCase then
|
if TTest(aSuite.Tests.Items[i]) is TTestCase then
|
||||||
Result := Result + trSpace(uLevel) + '<test>' + TTestcase(aSuite.Tests.Items[i]).TestName + '</test>' + System.sLineBreak;
|
Result := Result + StringOfChar(' ',Indent) + '<test>' + TTestcase(aSuite.Tests.Items[i]).TestName + '</test>' + System.sLineBreak;
|
||||||
Dec(uLevel, 2);
|
Dec(Indent, 2);
|
||||||
Result := Result + trSpace(uLevel) + '</TestSuite>' + System.sLineBreak;
|
Result := Result + StringOfChar(' ',Indent) + '</TestSuite>' + System.sLineBreak;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -336,7 +326,4 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
initialization
|
|
||||||
uLevel := 0;
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user