diff --git a/Source/PathHelper.Test.cs b/Source/PathHelper.Test.cs
index b20b369..4d4e335 100644
--- a/Source/PathHelper.Test.cs
+++ b/Source/PathHelper.Test.cs
@@ -37,7 +37,7 @@ namespace Nuclex.Support {
/// the location being passed is not relative to the base path.
///
[Test]
- public void TestRelativePathOfNonRelativePath() {
+ public void TestRelativeWindowsPathOfNonRelativePath() {
Assert.That(
PathHelper.MakeRelative(
platformify("C:/Folder1/Folder2"),
@@ -57,10 +57,10 @@ namespace Nuclex.Support {
///
/// Tests whether the relative path creator correctly builds the relative
- /// path to the parent folder of the base path.
+ /// path to the parent folder of the base path for windows paths.
///
[Test]
- public void TestRelativePathToParentFolder() {
+ public void TestRelativeWindowsPathToParentFolder() {
Assert.That(
PathHelper.MakeRelative(
platformify("C:/Folder1/Folder2"),
@@ -79,10 +79,32 @@ namespace Nuclex.Support {
///
/// Tests whether the relative path creator correctly builds the relative
- /// path to a nested folder in the base path.
+ /// path to the parent folder of the base path for unix paths.
///
[Test]
- public void TestRelativePathToNestedFolder() {
+ public void TestRelativeUnixPathToParentFolder() {
+ Assert.That(
+ PathHelper.MakeRelative(
+ platformify("/Folder1/Folder2"),
+ platformify("/Folder1")
+ ),
+ Is.EqualTo(platformify(".."))
+ );
+ Assert.That(
+ PathHelper.MakeRelative(
+ platformify("/Folder1/Folder2/"),
+ platformify("/Folder1/")
+ ),
+ Is.EqualTo(platformify("../"))
+ );
+ }
+
+ ///
+ /// Tests whether the relative path creator correctly builds the relative
+ /// path to a nested folder in the base path for windows paths.
+ ///
+ [Test]
+ public void TestRelativeWindowsPathToNestedFolder() {
Assert.That(
PathHelper.MakeRelative(
platformify("C:/Folder1"),
@@ -101,10 +123,32 @@ namespace Nuclex.Support {
///
/// Tests whether the relative path creator correctly builds the relative
- /// path to another folder on the same level as base path.
+ /// path to a nested folder in the base path for unix paths.
///
[Test]
- public void TestRelativePathToSiblingFolder() {
+ public void TestRelativeUnixPathToNestedFolder() {
+ Assert.That(
+ PathHelper.MakeRelative(
+ platformify("/Folder1"),
+ platformify("/Folder1/Folder2")
+ ),
+ Is.EqualTo(platformify("Folder2"))
+ );
+ Assert.That(
+ PathHelper.MakeRelative(
+ platformify("/Folder1/"),
+ platformify("/Folder1/Folder2/")
+ ),
+ Is.EqualTo(platformify("Folder2/"))
+ );
+ }
+
+ ///
+ /// Tests whether the relative path creator correctly builds the relative
+ /// path to another folder on the same level as base path for windows paths.
+ ///
+ [Test]
+ public void TestRelativeWindowsPathToSiblingFolder() {
Assert.That(
PathHelper.MakeRelative(
platformify("C:/Folder1/Folder2/"),
@@ -121,6 +165,28 @@ namespace Nuclex.Support {
);
}
+ ///
+ /// Tests whether the relative path creator correctly builds the relative
+ /// path to another folder on the same level as base path for unix paths.
+ ///
+ [Test]
+ public void TestRelativeUnixPathToSiblingFolder() {
+ Assert.That(
+ PathHelper.MakeRelative(
+ platformify("/Folder1/Folder2/"),
+ platformify("/Folder1/Folder2345")
+ ),
+ Is.EqualTo(platformify("../Folder2345"))
+ );
+ Assert.That(
+ PathHelper.MakeRelative(
+ platformify("/Folder1/Folder2345/"),
+ platformify("/Folder1/Folder2")
+ ),
+ Is.EqualTo(platformify("../Folder2"))
+ );
+ }
+
///
/// Converts unix-style directory separators into the format used by the current platform
///
diff --git a/Source/StringHelper.cs b/Source/StringHelper.cs
index f0aaca5..baa3160 100644
--- a/Source/StringHelper.cs
+++ b/Source/StringHelper.cs
@@ -28,7 +28,7 @@ namespace Nuclex.Support {
///
/// Searches for the first occurence of a character other than the characters
- /// listed in the < parameter
+ /// listed in the parameter
///
/// String that will be scanned in
/// Characters to not look for in the scanned string