From 828bfc7f134d22374e7d7590bad88f64e10d394f Mon Sep 17 00:00:00 2001 From: Dave Glick Date: Mon, 29 Feb 2016 16:28:00 -0500 Subject: [PATCH] Fix for PathTests Segements property to account for leading slash in path name, resolves #718 --- src/Cake.Core.Tests/Unit/IO/PathTests.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Cake.Core.Tests/Unit/IO/PathTests.cs b/src/Cake.Core.Tests/Unit/IO/PathTests.cs index 61783fc3f4..75e30e0464 100644 --- a/src/Cake.Core.Tests/Unit/IO/PathTests.cs +++ b/src/Cake.Core.Tests/Unit/IO/PathTests.cs @@ -118,19 +118,31 @@ public sealed class TheSegmentsProperty { [Theory] [InlineData("Hello/World")] - [InlineData("/Hello/World")] - [InlineData("/Hello/World/")] [InlineData("./Hello/World/")] public void Should_Return_Segments_Of_Path(string pathName) { // Given - var path = new TestingPath("Hello/World"); + var path = new TestingPath(pathName); // When, Then Assert.Equal(2, path.Segments.Length); Assert.Equal("Hello", path.Segments[0]); Assert.Equal("World", path.Segments[1]); } + + [Theory] + [InlineData("/Hello/World")] + [InlineData("/Hello/World/")] + public void Should_Return_Segments_Of_Path_And_Leave_Absolute_Directory_Separator_Intact(string pathName) + { + // Given + var path = new TestingPath(pathName); + + // When, Then + Assert.Equal(2, path.Segments.Length); + Assert.Equal("/Hello", path.Segments[0]); + Assert.Equal("World", path.Segments[1]); + } } public sealed class TheFullPathProperty