Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Runtime/Helper/PathHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ public static string Combine(params string[] paths)
continue;
}

if (path.StartsWithFast(separatorA) || path.StartsWithFast(separatorB))
{
continue;
}

sb.Append(separatorA);
}

Expand Down
53 changes: 53 additions & 0 deletions Tests/UtilityPathTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,5 +225,58 @@ public void RemoveEmptyDirectory_DirWithNonEmptySubDir_ReturnsFalse()
}

#endregion

#region PathHelper.Combine

[Test]
public void Combine_SingleSegment_ReturnsUnchanged()
{
string result = PathHelper.Combine("img.png");
Assert.AreEqual("img.png", result);
}

[Test]
public void Combine_TwoRelativeSegments_AddsSeparator()
{
string result = PathHelper.Combine("cache", "img.png");
Assert.AreEqual("cache/img.png", result);
}

[Test]
public void Combine_AbsolutePathSegment_AppendsSeparator()
{
string result = PathHelper.Combine("/Users/blank/cache", "img.png");
Assert.AreEqual("/Users/blank/cache/img.png", result);
}

[Test]
public void Combine_TrailingSlashSegment_DoesNotDuplicate()
{
string result = PathHelper.Combine("cache/", "img.png");
Assert.AreEqual("cache/img.png", result);
}

[Test]
public void Combine_PureSeparatorSegment_DoesNotDuplicate()
{
string result = PathHelper.Combine("/", "img.png");
Assert.AreEqual("/img.png", result);
}

[Test]
public void Combine_TrailingBackslashSegment_DoesNotDuplicate()
{
string result = PathHelper.Combine("dir\\", "file.txt");
Assert.AreEqual("dir\\file.txt", result);
}

[Test]
public void Combine_MultipleSegments_AbsolutePathJoint()
{
string result = PathHelper.Combine("/Users", "blank", "cache", "img.png");
Assert.AreEqual("/Users/blank/cache/img.png", result);
}

#endregion
}
}