Skip to content

Commit

Permalink
Add test for custom attributes with a null blob
Browse files Browse the repository at this point in the history
  • Loading branch information
jbevain committed Nov 7, 2011
1 parent 1f63857 commit abdf659
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Test/Mono.Cecil.Tests/CustomAttributesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,14 @@ public void ClosedGenericTypeOf (ModuleDefinition module)
Assert.AreEqual ("System.Collections.Generic.Dictionary`2<System.String,OpenGeneric`2<Machin,System.Int32>[,]>", type.FullName);
}

[TestIL ("types.il")]
public void EmptyBlob (ModuleDefinition module)
{
var attribute = module.GetType ("CustomAttribute");
Assert.AreEqual (1, attribute.CustomAttributes.Count);
Assert.AreEqual (0, attribute.CustomAttributes [0].ConstructorArguments.Count);
}

[Test]
public void DefineCustomAttributeFromBlob ()
{
Expand Down
12 changes: 12 additions & 0 deletions Test/Resources/il/types.il
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,15 @@
.field private static literal int16 int16_char = char(0x0073)
.field private static literal int32 int32_nullref = nullref
}

.class public auto ansi CustomAttribute extends [mscorlib]System.Attribute
{
.custom instance void CustomAttribute::.ctor() = ()

.method public hidebysig specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Attribute::.ctor()
ret
}
}

0 comments on commit abdf659

Please sign in to comment.