Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit 7eadbbb

Browse files
Merge pull request #822 from xamarin/private-issue
apparently, this wants a "/private" in the front.
2 parents bb0327a + f53f64a commit 7eadbbb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/tom-swifty-test/PosixUtilsTests.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ public void DotDotWorks1 ()
4040
public void RelativePathsInSymlinks1 ()
4141
{
4242
using (var dir = new DisposableTempDirectory ()) {
43-
var expectedPath = Path.GetDirectoryName (Path.GetDirectoryName (Path.GetDirectoryName (dir.DirectoryPath)));
43+
var sourcePath = PathWithoutLeadingSlash (Path.GetDirectoryName (Path.GetDirectoryName (Path.GetDirectoryName (dir.DirectoryPath))));
44+
var expectedPath = Path.Combine ("/private", sourcePath);
4445

4546
var link1 = Path.Combine (dir.DirectoryPath, "link1");
4647
symlink ("../../..", link1);
4748
var finalPath = PosixHelpers.RealPath (link1);
49+
4850
ClassicAssert.AreEqual (expectedPath, finalPath, "1");
4951
}
5052
}
@@ -53,7 +55,8 @@ public void RelativePathsInSymlinks1 ()
5355
public void RelativePathsInSymlinks2 ()
5456
{
5557
using (var dir = new DisposableTempDirectory ()) {
56-
var expectedPath = Path.GetDirectoryName (Path.GetDirectoryName (Path.GetDirectoryName (dir.DirectoryPath)));
58+
var sourcePath = PathWithoutLeadingSlash (Path.GetDirectoryName (Path.GetDirectoryName (Path.GetDirectoryName (dir.DirectoryPath))));
59+
var expectedPath = Path.Combine ("/private", sourcePath);
5760

5861
var link2 = Path.Combine (dir.DirectoryPath, "link2");
5962
symlink (Path.Combine (dir.DirectoryPath, "..", "..", ".."), link2);
@@ -65,5 +68,10 @@ public void RelativePathsInSymlinks2 ()
6568
// Mono.Unix can't create symlinks with relative paths, so P/Invoke instead.
6669
[DllImport ("/usr/lib/libSystem.dylib")]
6770
static extern int symlink (string path1, string path2);
71+
72+
static string PathWithoutLeadingSlash (string path)
73+
{
74+
return path.StartsWith ('/') ? path.Substring (1) : path;
75+
}
6876
}
6977
}

0 commit comments

Comments
 (0)