diff options
author | Jb Evain <jb@evain.net> | 2019-06-25 00:34:53 +0300 |
---|---|---|
committer | Jb Evain <jb@evain.net> | 2019-06-25 00:34:53 +0300 |
commit | 6e7bcbe3119353dc28f376743c228d2c255f47d5 (patch) | |
tree | 780ea4c67f71de3088e8536eb44005f9362d8df2 /Test/Mono.Cecil.Tests | |
parent | 6ba77d86beb7111d34ebc040a8f8e9f9fdad3f4d (diff) |
Add test for attributes on generic parameter constraints
Diffstat (limited to 'Test/Mono.Cecil.Tests')
-rw-r--r-- | Test/Mono.Cecil.Tests/CustomAttributesTests.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Test/Mono.Cecil.Tests/CustomAttributesTests.cs b/Test/Mono.Cecil.Tests/CustomAttributesTests.cs index 74ae750..47bafc8 100644 --- a/Test/Mono.Cecil.Tests/CustomAttributesTests.cs +++ b/Test/Mono.Cecil.Tests/CustomAttributesTests.cs @@ -450,6 +450,21 @@ namespace Mono.Cecil.Tests { } [Test] + public void GenericParameterConstraint () + { + TestModule ("GenericParameterConstraintAttributes.dll", module => { + var type = module.GetType ("Foo.Library`1"); + var gp = type.GenericParameters.Single (); + var constraint = gp.Constraints.Single (); + + Assert.IsTrue (constraint.HasCustomAttributes); + var attributes = constraint.CustomAttributes; + Assert.AreEqual (1, attributes.Count); + Assert.AreEqual ("System.Runtime.CompilerServices.NullableAttribute", attributes [0].AttributeType.FullName); + }); + } + + [Test] public void NullCharInString () { TestCSharp ("CustomAttributes.cs", module => { |