Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cec6bbe

Browse files
authored
Merge pull request #4418 from tamasvajk/feature/reenable-test
C#: Reenable disabled test on OSX
2 parents 8857579 + 36ddbcd commit cec6bbe

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • csharp/extractor/Semmle.Extraction.Tests

csharp/extractor/Semmle.Extraction.Tests/Layout.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ public void TestDefaultLayout()
4545
Directory.SetCurrentDirectory(tmpDir);
4646
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
4747
{
48-
// `Directory.SetCurrentDirectory()` doesn't seem to work on macOS,
49-
// so disable this test on macOS, for now
48+
// `Directory.SetCurrentDirectory()` seems to slightly change the path on macOS,
49+
// so adjusting it:
5050
Assert.NotEqual(Directory.GetCurrentDirectory(), tmpDir);
51-
return;
51+
tmpDir = "/private" + tmpDir;
52+
// Remove trailing slash:
53+
Assert.Equal('/', tmpDir[tmpDir.Length - 1]);
54+
tmpDir = tmpDir.Substring(0, tmpDir.Length - 1);
55+
Assert.Equal(Directory.GetCurrentDirectory(), tmpDir);
5256
}
5357
var f1 = project!.GetTrapPath(Logger, new TransformedPathStub("foo.cs"), TrapWriter.CompressionMode.Gzip);
5458
var g1 = TrapWriter.NestPaths(Logger, tmpDir, "foo.cs.trap.gz");

0 commit comments

Comments
 (0)