-
Notifications
You must be signed in to change notification settings - Fork 585
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #695 from sillyotter/NewPathCombineOperator
combinePaths with no trimming operations
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System.IO; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Fake; | ||
using Machine.Specifications; | ||
|
||
namespace Test.FAKECore | ||
{ | ||
public class when_combining_paths | ||
{ | ||
It should_strip_leading_slashes_when_using_combinePaths = | ||
() => | ||
{ | ||
var testValues = new List<string[]> { | ||
new[]{"/test/path", "/of/the/thing", "/test/path" + Path.DirectorySeparatorChar + "of/the/thing"}, | ||
new[]{"/test/path", "of/the/thing", "/test/path" + Path.DirectorySeparatorChar + "of/the/thing"}, | ||
}; | ||
|
||
if (Path.VolumeSeparatorChar != Path.DirectorySeparatorChar) | ||
{ | ||
var path2 = "X" + Path.VolumeSeparatorChar + "/test"; | ||
testValues.Add(new[]{"/test/path", path2, path2}); | ||
} | ||
|
||
foreach (var item in testValues) | ||
{ | ||
EnvironmentHelper.combinePaths(item[0], item[1]).ShouldEqual(item[2]); | ||
} | ||
}; | ||
|
||
It should_work_like_path_dot_combine_when_using_combinePathsNoTrim = | ||
() => | ||
{ | ||
var testValues = new List<string[]> { | ||
new[]{"/test/path", "/of/the/thing", "/of/the/thing"}, | ||
new[]{"/test/path", "of/the/thing", "/test/path" + Path.DirectorySeparatorChar + "of/the/thing"}, | ||
}; | ||
|
||
if (Path.VolumeSeparatorChar != Path.DirectorySeparatorChar) | ||
{ | ||
var path2 = "X" + Path.VolumeSeparatorChar + "/test"; | ||
testValues.Add(new[]{"/test/path", path2, path2}); | ||
} | ||
|
||
foreach (var item in testValues) | ||
{ | ||
EnvironmentHelper.combinePathsNoTrim(item[0], item[1]).ShouldEqual(item[2]); | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters