You've already forked lazarus-ccr
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:
68
components/svn/test/testsvncommand.pas
Normal file
68
components/svn/test/testsvncommand.pas
Normal 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.
|
||||
|
||||
Reference in New Issue
Block a user