Skip to content

Commit fa8800d

Browse files
committed
Fix AppCleaner test for cross-platform compatibility
The exclusive file lock used to force Directory.Delete failure only works on Windows. On Linux, deletion succeeds anyway so adjust asserts to match platform behavior while still covering fallback on Windows.
1 parent 45946c6 commit fa8800d

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/Tests/AppCleanerTests.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,17 @@ public void Clean_deletes_stamp_when_publish_directory_delete_fails()
3232
var exit = AppCleaner.Clean(root, stamp);
3333

3434
Assert.Equal(0, exit);
35-
Assert.True(Directory.Exists(root));
36-
Assert.False(File.Exists(stamp));
35+
if (OperatingSystem.IsWindows())
36+
{
37+
// Exclusive lock should cause Directory.Delete to fail, triggering stamp-only fallback
38+
Assert.True(Directory.Exists(root));
39+
Assert.False(File.Exists(stamp));
40+
}
41+
else
42+
{
43+
// On Unix, open file locks do not prevent directory deletion; dir (and stamp) are removed
44+
Assert.False(Directory.Exists(root));
45+
}
3746
}
3847

3948
[Fact]

0 commit comments

Comments
 (0)