Skip to content

Commit 1194f28

Browse files
committed
test delete hits file helper method
1 parent 26538f8 commit 1194f28

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/coverlet.core/Helpers/InstrumentationHelper.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public static void RestoreOriginalModule(string module, string identifier)
7171
currentSleep *= 2;
7272
return sleep;
7373
};
74+
7475
RetryHelper.Retry(() => {
7576
File.Copy(backupPath, module, true);
7677
File.Delete(backupPath);
@@ -87,6 +88,7 @@ public static void DeleteHitsFile(string path)
8788
currentSleep *= 2;
8889
return sleep;
8990
};
91+
9092
RetryHelper.Retry(() => File.Delete(path), retryStrategy, 10);
9193
}
9294
}

test/coverlet.core.tests/Helpers/InstrumentationHelperTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,15 @@ public void TestDontCopyCoverletDependency()
5959
Assert.False(File.Exists(Path.Combine(directory.FullName, "coverlet.core.dll")));
6060
Directory.Delete(directory.FullName, true);
6161
}
62+
63+
[Fact]
64+
public void TestDeleteHitsFile()
65+
{
66+
var tempFile = Path.GetTempFileName();
67+
Assert.True(File.Exists(tempFile));
68+
69+
InstrumentationHelper.DeleteHitsFile(tempFile);
70+
Assert.False(File.Exists(tempFile));
71+
}
6272
}
6373
}

0 commit comments

Comments
 (0)