[JEDI.NET-commits] nunit/source Jedi.IO.NUnit.pas,1.2,1.3 Jedi.IO.Paths.Nunit.pas,1.2,1.3
Status: Pre-Alpha
Brought to you by:
jedi_mbe
From: Marcel B. <jed...@us...> - 2005-03-29 10:49:26
|
Update of /cvsroot/jedidotnet/nunit/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24908/nunit/source Modified Files: Jedi.IO.NUnit.pas Jedi.IO.Paths.Nunit.pas Log Message: Added test-cases to prove bug in either CommonBaseOf or MakeRelativeFrom with two paths having no common base at all. Index: Jedi.IO.Paths.Nunit.pas =================================================================== RCS file: /cvsroot/jedidotnet/nunit/source/Jedi.IO.Paths.Nunit.pas,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Jedi.IO.Paths.Nunit.pas 28 Mar 2005 18:14:27 -0000 1.2 --- Jedi.IO.Paths.Nunit.pas 29 Mar 2005 10:49:12 -0000 1.3 *************** *** 50,56 **** [Test] procedure CombineTwo; [Test] procedure CombineTwoAbsolutePaths; [Test] procedure CommonBaseOfFour; [Test] procedure CommonBaseOfTwo; ! [Test] procedure MakeRelativeFrom; end; --- 50,60 ---- [Test] procedure CombineTwo; [Test] procedure CombineTwoAbsolutePaths; + [Test] procedure CommonBaseOfFive; [Test] procedure CommonBaseOfFour; [Test] procedure CommonBaseOfTwo; ! [Test] procedure MakeRelativeFromNoCommonBase; ! [Test] procedure MakeRelativeFromOneLevelUp; ! [Test] procedure MakeRelativeFromSameLevel; ! [Test] procedure MakeRelativeFromTwoLevelsUp; end; *************** *** 246,252 **** end; procedure Manipulations.CommonBaseOfFour; begin ! Assert.AreEqual(PathTestCases.sCommonPathOfAll4, Path.CommonBase([PathTestCases.sCommonPath1, PathTestCases.sCommonPath2, PathTestCases.sCommonPath3, PathTestCases.sCommonPath4])); end; --- 250,262 ---- end; + procedure Manipulations.CommonBaseOfFive; + begin + Assert.AreEqual(PathTestCases.sCommonPathOfAll5, Path.CommonBase([PathTestCases.sCommonPath1, + PathTestCases.sCommonPath2, PathTestCases.sCommonPath3, PathTestCases.sCommonPath4, PathTestCases.sCommonPath5])); + end; + procedure Manipulations.CommonBaseOfFour; begin ! Assert.AreEqual(PathTestCases.sCommonPathOfFirst4, Path.CommonBase([PathTestCases.sCommonPath1, PathTestCases.sCommonPath2, PathTestCases.sCommonPath3, PathTestCases.sCommonPath4])); end; *************** *** 260,266 **** Assert.AreEqual(PathTestCases.sCommonPathOf1And4, Path.CommonBase(PathTestCases.sCommonPath1, PathTestCases.sCommonPath4), 'Paths 1 and 4'); end; ! procedure Manipulations.MakeRelativeFrom; begin Assert.AreEqual(PathTestCases.sRelativePath1, Path.MakeRelativeFrom(PathTestCases.sCommonPath1, --- 270,290 ---- Assert.AreEqual(PathTestCases.sCommonPathOf1And4, Path.CommonBase(PathTestCases.sCommonPath1, PathTestCases.sCommonPath4), 'Paths 1 and 4'); + Assert.AreEqual(PathTestCases.sCommonPathOf1And5, Path.CommonBase(PathTestCases.sCommonPath1, + PathTestCases.sCommonPath5), 'Paths 1 and 5'); end; ! procedure Manipulations.MakeRelativeFromOneLevelUp; ! begin ! Assert.AreEqual(PathTestCases.sRelativePath3, Path.MakeRelativeFrom(PathTestCases.sCommonPath3, ! PathTestCases.sRelativeBasePath)); ! end; ! ! procedure Manipulations.MakeRelativeFromNoCommonBase; ! begin ! Assert.AreEqual(PathTestCases.sRelativePath5, Path.MakeRelativeFrom(PathTestCases.sCommonPath5, ! PathTestCases.sRelativeBasePath)); ! end; ! ! procedure Manipulations.MakeRelativeFromSameLevel; begin Assert.AreEqual(PathTestCases.sRelativePath1, Path.MakeRelativeFrom(PathTestCases.sCommonPath1, *************** *** 268,275 **** Assert.AreEqual(PathTestCases.sRelativePath2, Path.MakeRelativeFrom(PathTestCases.sCommonPath2, PathTestCases.sRelativeBasePath), 'Path 2'); ! Assert.AreEqual(PathTestCases.sRelativePath3, Path.MakeRelativeFrom(PathTestCases.sCommonPath3, ! PathTestCases.sRelativeBasePath), 'Path 3'); Assert.AreEqual(PathTestCases.sRelativePath4, Path.MakeRelativeFrom(PathTestCases.sCommonPath4, ! PathTestCases.sRelativeBasePath), 'Path 4'); end; {$ENDREGION} --- 292,301 ---- Assert.AreEqual(PathTestCases.sRelativePath2, Path.MakeRelativeFrom(PathTestCases.sCommonPath2, PathTestCases.sRelativeBasePath), 'Path 2'); ! end; ! ! procedure Manipulations.MakeRelativeFromTwoLevelsUp; ! begin Assert.AreEqual(PathTestCases.sRelativePath4, Path.MakeRelativeFrom(PathTestCases.sCommonPath4, ! PathTestCases.sRelativeBasePath)); end; {$ENDREGION} Index: Jedi.IO.NUnit.pas =================================================================== RCS file: /cvsroot/jedidotnet/nunit/source/Jedi.IO.NUnit.pas,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Jedi.IO.NUnit.pas 28 Mar 2005 18:13:44 -0000 1.2 --- Jedi.IO.NUnit.pas 29 Mar 2005 10:49:11 -0000 1.3 *************** *** 37,41 **** const sNormCommonPathOf1And3 = 'c{0}{1}My Documents'; const sNormCommonPathOf1And4 = 'c{0}'; ! const sNormCommonPathOfAll4 = 'c{0}'; strict protected const sNormRelativePath1 = 'First folder{1}test1.txt'; --- 37,43 ---- const sNormCommonPathOf1And3 = 'c{0}{1}My Documents'; const sNormCommonPathOf1And4 = 'c{0}'; ! const sNormCommonPathOf1And5 = ''; ! const sNormCommonPathOfFirst4 = 'c{0}'; ! const sNormCommonPathOfAll5 = ''; strict protected const sNormRelativePath1 = 'First folder{1}test1.txt'; *************** *** 43,46 **** --- 45,49 ---- const sNormRelativePath3 = '..{1}Secondary group{1}First folder{1}test 2.txt'; const sNormRelativePath4 = '..{1}..{1}My Music{1}test1.mp3'; + const sNormRelativePath5 = 'd{0}{1}No common{1}base{1}path.txt'; public const sVolumeRoot = 'volume:\'; *************** *** 64,67 **** --- 67,71 ---- const sCommonPath3 = 'c:\My Documents\Secondary group\First folder\test 2.txt'; const sCommonPath4 = 'c:\My Music\test1.mp3'; + const sCommonPath5 = 'd:/No common\base\path.txt'; public const sRelativeBasePath = 'c:\My Documents\Testing'; *************** *** 94,98 **** sCommonPathOf1And3: string; sCommonPathOf1And4: string; ! sCommonPathOfAll4: string; public class var --- 98,104 ---- sCommonPathOf1And3: string; sCommonPathOf1And4: string; ! sCommonPathOf1And5: string; ! sCommonPathOfFirst4: string; ! sCommonPathOfAll5: string; public class var *************** *** 101,104 **** --- 107,111 ---- sRelativePath3: string; sRelativePath4: string; + sRelativePath5: string; end; |