mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-31 00:42:39 +02:00
test: added TestCreateRelativePath
git-svn-id: trunk@28993 -
This commit is contained in:
parent
e372929332
commit
ca536d0252
@ -12,10 +12,13 @@ type
|
||||
|
||||
{ TTestFileUtil }
|
||||
|
||||
{ TTestFileProc }
|
||||
|
||||
TTestFileProc= class(TTestCase)
|
||||
published
|
||||
procedure TestFileIsExecutable;
|
||||
procedure TestTrimFileName;
|
||||
procedure TestCreateRelativePath;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -47,6 +50,40 @@ begin
|
||||
DoTest('$(LazarusDir)\..\dir\','$(LazarusDir)\..\dir\');
|
||||
end;
|
||||
|
||||
procedure TTestFileProc.TestCreateRelativePath;
|
||||
|
||||
procedure DoTest(Filename, BaseDirectory, Expected: string;
|
||||
UsePointDirectory: boolean = false);
|
||||
begin
|
||||
DoDirSeparators(Filename);
|
||||
DoDirSeparators(BaseDirectory);
|
||||
DoDirSeparators(Expected);
|
||||
AssertEquals('CreateRelativePath(File='+Filename+',Base='+BaseDirectory+')',
|
||||
Expected,
|
||||
CreateRelativePath(Filename,BaseDirectory,UsePointDirectory));
|
||||
end;
|
||||
|
||||
begin
|
||||
DoTest('/a','/a','');
|
||||
DoTest('/a','/a/','');
|
||||
DoTest('/a/b','/a/b','');
|
||||
DoTest('/a/b','/a/b/','');
|
||||
DoTest('/a','/a/','');
|
||||
DoTest('/a','','/a');
|
||||
DoTest('/a/b','/a','b');
|
||||
DoTest('/a/b','/a/','b');
|
||||
DoTest('/a/b','/a//','b');
|
||||
DoTest('/a','/a/b','../');
|
||||
DoTest('/a','/a/b/','../');
|
||||
DoTest('/a','/a/b//','../');
|
||||
DoTest('/a/','/a/b','../');
|
||||
DoTest('/a','/a/b/c','../../');
|
||||
DoTest('/a','/a/b//c','../../');
|
||||
DoTest('/a','/a//b/c','../../');
|
||||
DoTest('/a','/a//b/c/','../../');
|
||||
DoTest('/a','/b','/a');
|
||||
end;
|
||||
|
||||
initialization
|
||||
// TODO: Maybe this test case should be moved to another testsuite, e.g. codetools test
|
||||
AddToBugsTestSuite(TTestSuite.Create(TTestFileProc, 'TestFileProc'));
|
||||
|
@ -69,7 +69,7 @@ end;
|
||||
procedure TLazTestRunner.WriteCustomHelp;
|
||||
begin
|
||||
writeln(' --compiler=<ppcxxx> use ppcxxx to build test projects');
|
||||
writeln(' --pcp=<primarty-config-path> pass primarty-config-path to lazbuild');
|
||||
writeln(' --pcp=<primary-config-path> pass primary-config-path to lazbuild');
|
||||
writeln(' --submitter=SubmitterName name of sumbitter of the test results');
|
||||
writeln(' --machine=MachineName name of the machine the test runs on');
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user