diff options
author | Jb Evain <jb@evain.net> | 2017-04-26 04:03:49 +0300 |
---|---|---|
committer | Jb Evain <jb@evain.net> | 2017-04-26 04:30:55 +0300 |
commit | ce9022669c64030b22ded37aeaf96643691d7957 (patch) | |
tree | 8aa248a71be309430a09948f7da1bbc66f52c190 /Test/Mono.Cecil.Tests | |
parent | 727305ba6c3b7d3eefe52439b5070332abbf15f0 (diff) |
Dispose owned stream even when an exception is thrown
Diffstat (limited to 'Test/Mono.Cecil.Tests')
-rw-r--r-- | Test/Mono.Cecil.Tests/ModuleTests.cs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Test/Mono.Cecil.Tests/ModuleTests.cs b/Test/Mono.Cecil.Tests/ModuleTests.cs index 3c930e2..e57d6bd 100644 --- a/Test/Mono.Cecil.Tests/ModuleTests.cs +++ b/Test/Mono.Cecil.Tests/ModuleTests.cs @@ -301,11 +301,10 @@ namespace Mono.Cecil.Tests { var path = Path.GetTempFileName (); var module = ModuleDefinition.CreateModule ("FooFoo", ModuleKind.Dll); + // Mixed mode module that Cecil can not write + module.Attributes = (ModuleAttributes) 0; - // Invalid type to make writing throw - module.Types.Add (new TypeDefinition ("Foo", "Foo", (TypeAttributes) 0)); - - Assert.Throws<Exception>(() => module.Write (path)); + Assert.Throws<NotSupportedException>(() => module.Write (path)); // Ensure you can still delete the file File.Delete (path); |