You've already forked lazarus-ccr
added TSvnPropInfo class to hold svn proplist output
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@112 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -16,13 +16,17 @@ type
|
||||
private
|
||||
function GetInfoFileName: string;
|
||||
function GetLogFileName: string;
|
||||
function GetPropFileName: string;
|
||||
published
|
||||
procedure TestHookUp;
|
||||
procedure TestLoadInfo;
|
||||
procedure TestInfoCreateUrl;
|
||||
procedure TestLoadLog;
|
||||
procedure TestLoadSimpleLogPaths;
|
||||
procedure TestLoadComplexLogPaths;
|
||||
procedure TestLoadLogTwice;
|
||||
procedure TestLogCommonPath;
|
||||
procedure TestPropList;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@@ -37,6 +41,11 @@ begin
|
||||
Result := ExtractFilePath(ParamStr(0)) + 'log.xml';
|
||||
end;
|
||||
|
||||
function TTestSvnClasses.GetPropFileName: string;
|
||||
begin
|
||||
Result := ExtractFilePath(ParamStr(0)) + 'proplist.txt';
|
||||
end;
|
||||
|
||||
procedure TTestSvnClasses.TestHookUp;
|
||||
procedure CheckFile(const FileName: string);
|
||||
begin
|
||||
@@ -75,6 +84,20 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTestSvnClasses.TestInfoCreateUrl;
|
||||
var
|
||||
SvnInfo: TSvnInfo;
|
||||
begin
|
||||
SvnInfo := TSvnInfo.Create('.');
|
||||
try
|
||||
AssertEquals('Wrong repository UUID',
|
||||
'8e941d3f-bd1b-0410-a28a-d453659cc2b4',
|
||||
SvnInfo.Entry.Repository.UUID);
|
||||
finally
|
||||
SvnInfo.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTestSvnClasses.TestLoadLog;
|
||||
var
|
||||
SvnLog: TSvnLog;
|
||||
@@ -164,6 +187,58 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTestSvnClasses.TestLogCommonPath;
|
||||
var
|
||||
SvnLog: TSvnLog;
|
||||
procedure AssertCommonPath(i: integer;const ACommonPath: string);
|
||||
var
|
||||
LogEntry: TLogEntry;
|
||||
begin
|
||||
LogEntry := SvnLog.LogEntry[i];
|
||||
AssertEquals('Wrong common path '+IntToStr(i), ACommonPath, LogEntry.CommonPath);
|
||||
end;
|
||||
|
||||
begin
|
||||
SvnLog := TSvnLog.Create;
|
||||
try
|
||||
SvnLog.LoadFromFile(GetLogFileName);
|
||||
AssertEquals('Wrong number of log entries', 6, SvnLog.LogEntryCount);
|
||||
AssertCommonPath(4, '/trunk/lcl/interfaces/win32/');
|
||||
AssertCommonPath(5, '/trunk/lcl/interfaces/win32/');
|
||||
AssertCommonPath(3, '/trunk/components/tachart/');
|
||||
AssertCommonPath(0, '/trunk/');
|
||||
finally
|
||||
SvnLog.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTestSvnClasses.TestPropList;
|
||||
var
|
||||
SvnPropInfo: TSvnPropInfo;
|
||||
|
||||
procedure AssertFileProp(i: integer; const FileName: string);
|
||||
var
|
||||
FileProp: TSvnFileProp;
|
||||
begin
|
||||
FileProp := SvnPropInfo.FileItem[i];
|
||||
AssertEquals('Wrong file name', FileName, FileProp.FileName);
|
||||
AssertEquals('Wrong number of properties', 2, FileProp.Properties.Count);
|
||||
AssertEquals('Wrong property name', 'svn:mime-type', FileProp.Properties.Names[0]);
|
||||
AssertEquals('Wrong property value', 'text/plain', FileProp.Properties.ValueFromIndex[0]);
|
||||
end;
|
||||
begin
|
||||
SvnPropInfo := TSvnPropInfo.Create;
|
||||
try
|
||||
SvnPropInfo.LoadFromFile(GetPropFileName);
|
||||
AssertEquals('Wrong number of files', 3, SvnPropInfo.FileCount);
|
||||
AssertFileProp(0, 'testsvnclasses.pas');
|
||||
AssertFileProp(1, 'testsvncommand.pas');
|
||||
AssertFileProp(2, 'fpcunitsvnpkg.lpi');
|
||||
finally
|
||||
SvnPropInfo.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
RegisterTest(TTestSvnClasses);
|
||||
|
Reference in New Issue
Block a user