2005-12-10 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Sat, 10 Dec 2005 21:17:08 +0000 (21:17 -0000)
committerZoltan Varga <vargaz@gmail.com>
Sat, 10 Dec 2005 21:17:08 +0000 (21:17 -0000)
* MethodBuilderTest.cs: Add test for handling not accessible custom
attributes.

svn path=/trunk/mcs/; revision=54197

mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
mcs/class/corlib/Test/System.Reflection.Emit/MethodBuilderTest.cs

index 4d67bcfb9a3473a407b4908a8b1e20ca09e799c6..4f149c16aa1eb343dc139bad41079fd9356b113b 100644 (file)
@@ -1,3 +1,8 @@
+2005-12-10  Zoltan Varga  <vargaz@gmail.com>
+
+       * MethodBuilderTest.cs: Add test for handling not accessible custom
+       attributes.
+
 2005-10-27  Zoltan Varga  <vargaz@gmail.com>
 
        * FieldBuilderTest.cs MethodBuilderTest.cs ConstructorBuilderTest.cs:
index f63bf0127e2515035bbf245f957d27530985cbb2..e56395c75a583a504dd60bb331ef481b924bfed6 100644 (file)
@@ -535,6 +535,13 @@ public class MethodBuilderTest : Assertion
                }
        }
 
+       [AttributeUsage (AttributeTargets.Parameter)]
+       class PrivateAttribute : Attribute {
+
+               public PrivateAttribute () {
+               }
+       }
+
        [Test]
        public void GetCustomAttributes () {
                TypeBuilder tb = module.DefineType (genTypeName (), TypeAttributes.Public);
@@ -549,6 +556,9 @@ public class MethodBuilderTest : Assertion
 
                mb.SetCustomAttribute (new CustomAttributeBuilder (ctorInfo, new object [] { "FOO" }));
 
+               // Check that attributes not accessible are not returned
+               mb.SetCustomAttribute (new CustomAttributeBuilder (typeof (PrivateAttribute).GetConstructor (new Type [0]), new object [] { }));
+
                Type t = tb.CreateType ();
 
                // Try the created type