diff options
author | Jeffrey Stedfast <jestedfa@microsoft.com> | 2019-06-07 22:03:12 +0300 |
---|---|---|
committer | Marius Ungureanu <marius.ungureanu@xamarin.com> | 2019-06-07 22:03:12 +0300 |
commit | 2a81c095ac8429d9078c71a0850ad834b8d25437 (patch) | |
tree | a343f29c687469d89916fa48c4902a4e07c459fd /UnitTests | |
parent | 0ab6b6eb9331f4dcbda476d5652584ed8feeac2b (diff) |
[UnitTests] Remove tmp files after we're done with them. (#228)
Diffstat (limited to 'UnitTests')
-rw-r--r-- | UnitTests/Mono.Debugging.Tests/Shared/SourceLocationTests.cs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/UnitTests/Mono.Debugging.Tests/Shared/SourceLocationTests.cs b/UnitTests/Mono.Debugging.Tests/Shared/SourceLocationTests.cs index 9da44cd..7273667 100644 --- a/UnitTests/Mono.Debugging.Tests/Shared/SourceLocationTests.cs +++ b/UnitTests/Mono.Debugging.Tests/Shared/SourceLocationTests.cs @@ -47,18 +47,23 @@ namespace Mono.Debugging.Tests string tmp; tmp = Path.GetTempFileName (); - File.WriteAllBytes (tmp, buffer); - Assert.IsTrue (SourceLocation.CheckFileHash (tmp, checksum), "CheckFileHash {0} ({1})", algorithm, mode); + try { + File.WriteAllBytes (tmp, buffer); - if (checksum.Length > 16) { - var roslyn = new byte[16]; + Assert.IsTrue (SourceLocation.CheckFileHash (tmp, checksum), "CheckFileHash {0} ({1})", algorithm, mode); - roslyn[0] = (byte) checksum.Length; - for (int i = 1; i < 16; i++) - roslyn[i] = checksum[i - 1]; + if (checksum.Length > 16) { + var roslyn = new byte [16]; - Assert.IsTrue (SourceLocation.CheckFileHash (tmp, checksum), "CheckFileHash Roslyn {0} ({1})", algorithm, mode); + roslyn [0] = (byte)checksum.Length; + for (int i = 1; i < 16; i++) + roslyn [i] = checksum [i - 1]; + + Assert.IsTrue (SourceLocation.CheckFileHash (tmp, checksum), "CheckFileHash Roslyn {0} ({1})", algorithm, mode); + } + } finally { + File.Delete (tmp); } } } |