svn: added unit for executing svn commands and capturing the output

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@99 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
vsnijders
2007-02-27 15:55:11 +00:00
parent 0280be7f26
commit c1e34e90a8
7 changed files with 216 additions and 7 deletions

View File

@ -38,7 +38,7 @@
<PackageName Value="FCL"/>
</Item4>
</RequiredPackages>
<Units Count="2">
<Units Count="3">
<Unit0>
<Filename Value="fpcunitsvnpkg.lpr"/>
<IsPartOfProject Value="True"/>
@ -49,6 +49,11 @@
<IsPartOfProject Value="True"/>
<UnitName Value="TestSvnClasses"/>
</Unit1>
<Unit2>
<Filename Value="testsvncommand.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="TestSvnCommand"/>
</Unit2>
</Units>
</ProjectOptions>
<CompilerOptions>
@ -59,10 +64,11 @@
</CodeGeneration>
<Linking>
<Debugging>
<UseHeaptrc Value="True"/>
<UseLineInfoUnit Value="False"/>
</Debugging>
</Linking>
<Other>
<CustomOptions Value="-Faheaptrc"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>

View File

@ -3,7 +3,7 @@ program fpcunitsvnpkg;
{$mode objfpc}{$H+}
uses
Interfaces, Forms, GuiTestRunner, TestSvnClasses, svnpkg;
Interfaces, Forms, GuiTestRunner, TestSvnClasses, svnpkg, TestSvnCommand;
begin
Application.Initialize;

View File

@ -0,0 +1,68 @@
unit TestSvnCommand;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, fpcunit, testregistry,
SvnCommand, svnclasses;
type
{ TTestSvnCommand }
TTestSvnCommand= class(TTestCase)
published
procedure TestHookUp;
procedure TestGetInfo;
end;
implementation
procedure TTestSvnCommand.TestHookUp;
var
SvnExitCode : integer;
XmlOutput: TMemoryStream;
begin
try
XmlOutput:= TMemoryStream.Create;
SvnExitCode := ExecuteSvnCommand('log --xml -rHEAD', XmlOutput);
AssertEquals('Unexpected exit code', 0, SvnExitCode);
AssertTrue('No XmlOuput', XmlOutput.Size>0)
finally
XmlOutput.Free;
end;
end;
procedure TTestSvnCommand.TestGetInfo;
var
SvnExitCode : integer;
XmlOutput: TMemoryStream;
SvnInfo: TSvnInfo;
begin
try
XmlOutput:= TMemoryStream.Create;
SvnExitCode := ExecuteSvnCommand('info --xml .', XmlOutput);
AssertEquals('Unexpected exit code', 0, SvnExitCode);
AssertTrue('No XmlOuput', XmlOutput.Size>0);
SvnInfo := TSvnInfo.Create;
try
XmlOutput.Position := 0;
SvnInfo.LoadFromStream(XmlOutput);
AssertEquals('Wrong repository UUID',
'8e941d3f-bd1b-0410-a28a-d453659cc2b4',
SvnInfo.Entry.Repository.UUID);
finally
SvnInfo.Free;
end;
finally
XmlOutput.Free;
end;
end;
initialization
RegisterTest(TTestSvnCommand);
end.