2010-04-16 Rodrigo Kumpera <rkumpera@novell.com>
authorRodrigo Kumpera <kumpera@gmail.com>
Fri, 16 Apr 2010 20:40:52 +0000 (20:40 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Fri, 16 Apr 2010 20:40:52 +0000 (20:40 -0000)
* AttributeTest.cs: Add regression test for #499569.

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

mcs/class/corlib/Test/System/AttributeTest.cs
mcs/class/corlib/Test/System/ChangeLog

index da399cde42f64483132ebd22623cc19392dc2c03..9a4271672375875f4b5818b2e8e5bbca2542931d 100644 (file)
@@ -726,7 +726,6 @@ namespace MonoTests.System
                        Assert.IsFalse (a.Equals (null), "#8");
                }
 
-#if NET_2_0
                class UserType : TypeDelegator {
                        public int GetCattr1;
                        public int GetCattr2;
@@ -863,8 +862,44 @@ namespace MonoTests.System
                                Assert.Fail ("#1");
                        } catch (NotSupportedException) {}
                }
-#endif
 
+               [Test] //Regression test for #499569
+               public void GetCattrOnPropertyAndInheritance ()
+               {
+                       var m = typeof(Sub).GetProperty ("Name");
+                       var res = Attribute.GetCustomAttributes (m, typeof(MyAttribute), true);
+                       Assert.AreEqual (1, res.Length, "#1");
+               }
+
+               abstract class Abs
+               {
+                       public abstract string Name { get; set; }
+               }
+               
+               class Base: Abs
+               {
+                       [MyAttribute]
+                       public override string Name {
+                               get { return ""; }
+                               set {}
+                       }
+               }
+               
+               class Sub: Base
+               {
+                       public override string Name {
+                               get { return ""; }
+                               set {}
+                       }
+               }
+               
+               class MySubAttribute: MyAttribute
+               {
+               }
+               
+               class MyAttribute: Attribute
+               {
+               }
 
                private int GetAttributeCount (object[] attributes, Type attributeType)
                {
index 06867e0214d68f2fa59fe0b88abffb53f36b2636..4780008709efae8157bb8050f9272834f8314724 100644 (file)
@@ -1,3 +1,7 @@
+2010-04-16 Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * AttributeTest.cs: Add regression test for #499569.
+
 2010-04-15  Jb Evain  <jbevain@novell.com>
 
        * GuidTest.cs: add tests for net_4_0 ParseExact methods.