Skip to content

Commit 0305df7

Browse files
authored
Merge pull request #138 IsFileSystemSupported: cleanup test files on Mac
IsFileSystemSupported: cleanup test files on Mac
2 parents e15616c + 8303aeb commit 0305df7

2 files changed

Lines changed: 25 additions & 7 deletions

File tree

Scalar.FunctionalTests/Tests/EnlistmentPerFixture/CloneTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,24 @@ public void CloneToPathWithSpaces()
106106
enlistment.UnmountAndDeleteAll();
107107
}
108108

109+
[TestCase]
110+
public void CloneCreatesCorrectFilesInRoot()
111+
{
112+
ScalarFunctionalTestEnlistment enlistment = ScalarFunctionalTestEnlistment.CloneAndMount(ScalarTestConfig.PathToScalar);
113+
try
114+
{
115+
Directory.GetFiles(enlistment.EnlistmentRoot).ShouldBeEmpty("There should be no files in the enlistment root after cloning");
116+
string[] directories = Directory.GetDirectories(enlistment.EnlistmentRoot);
117+
directories.Length.ShouldEqual(2);
118+
directories.ShouldContain(x => Path.GetFileName(x).Equals(".scalar", StringComparison.Ordinal));
119+
directories.ShouldContain(x => Path.GetFileName(x).Equals("src", StringComparison.Ordinal));
120+
}
121+
finally
122+
{
123+
enlistment.UnmountAndDeleteAll();
124+
}
125+
}
126+
109127
private void SubfolderCloneShouldFail()
110128
{
111129
ProcessStartInfo processInfo = new ProcessStartInfo(ScalarTestConfig.PathToScalar);

Scalar.Platform.Mac/MacFileSystem.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ public override bool IsSocket(string fileName)
2727

2828
public override bool IsFileSystemSupported(string path, out string error)
2929
{
30-
string lowerCaseFile = Guid.NewGuid().ToString().ToLower();
31-
string upperCaseFile = lowerCaseFile.ToUpper();
3230
error = null;
33-
3431
try
3532
{
36-
File.Create(Path.Combine(path, lowerCaseFile));
37-
if (File.Exists(Path.Combine(path, upperCaseFile)))
33+
string lowerCaseFilePath = Path.Combine(path, $"casetest{Guid.NewGuid().ToString()}");
34+
string upperCaseFilePath = lowerCaseFilePath.ToUpper();
35+
36+
File.Create(lowerCaseFilePath);
37+
if (File.Exists(upperCaseFilePath))
3838
{
39-
File.Delete(lowerCaseFile);
39+
File.Delete(lowerCaseFilePath);
4040
return true;
4141
}
4242

43-
File.Delete(lowerCaseFile);
43+
File.Delete(lowerCaseFilePath);
4444
error = "Scalar does not support case sensitive filesystems";
4545
return false;
4646
}

0 commit comments

Comments
 (0)