From 71debc2b8942844c721d7849b48286dc13c3c8db Mon Sep 17 00:00:00 2001 From: Stephen Connolly Date: Tue, 1 May 2012 09:39:05 +0100 Subject: [PATCH] [JENKINS-13649] Adding a test case --- core/src/test/java/hudson/FilePathTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/src/test/java/hudson/FilePathTest.java b/core/src/test/java/hudson/FilePathTest.java index 4122205375..b6592f3780 100644 --- a/core/src/test/java/hudson/FilePathTest.java +++ b/core/src/test/java/hudson/FilePathTest.java @@ -379,4 +379,17 @@ public class FilePathTest extends ChannelTestCase { tmp.deleteRecursive(); } } + + @Bug(13649) + public void testMultiSegmentRelativePaths() throws Exception { + FilePath winPath = new FilePath(new LocalChannel(null), "c:\\app\\jenkins\\workspace"); + FilePath nixPath = new FilePath(new LocalChannel(null), "/opt/jenkins/workspace"); + + assertEquals("c:\\app\\jenkins\\workspace\\foo\\bar\\manchu", new FilePath(winPath, "foo/bar/manchu").getRemote()); + assertEquals("c:\\app\\jenkins\\workspace\\foo\\bar\\manchu", new FilePath(winPath, "foo\\bar/manchu").getRemote()); + assertEquals("c:\\app\\jenkins\\workspace\\foo\\bar\\manchu", new FilePath(winPath, "foo\\bar\\manchu").getRemote()); + assertEquals("/opt/jenkins/workspace/foo/bar/manchu", new FilePath(nixPath, "foo\\bar\\manchu").getRemote()); + assertEquals("/opt/jenkins/workspace/foo/bar/manchu", new FilePath(nixPath, "foo/bar\\manchu").getRemote()); + assertEquals("/opt/jenkins/workspace/foo/bar/manchu", new FilePath(nixPath, "foo/bar/manchu").getRemote()); + } }