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

@@ -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.