2004-01-09 Zoltan Varga <vargaz@freemail.hu>
authorZoltan Varga <vargaz@gmail.com>
Fri, 9 Jan 2004 16:02:46 +0000 (16:02 -0000)
committerZoltan Varga <vargaz@gmail.com>
Fri, 9 Jan 2004 16:02:46 +0000 (16:02 -0000)
* custom-attr.cs: Add test for properties with array type.

svn path=/trunk/mono/; revision=21879

mono/tests/ChangeLog
mono/tests/custom-attr.cs

index 13cf80c5d078b9db9af5410b634b65b053c0bfbe..b820469118348d878cb1fac3983d83d067ff78f6 100644 (file)
@@ -1,3 +1,7 @@
+2004-01-09  Zoltan Varga  <vargaz@freemail.hu>
+
+       * custom-attr.cs: Add test for properties with array type.
+
 2003-12-13  Patrik Torstensson  <p@rxc.se>
 
        * bug-42136.cs: invalid liveness analyse for locals
index 4fa114186a935cd011e73e70ef60994841d578b3..4105f244bfbfb041c350b9c4f3f42f63b3222260 100644 (file)
@@ -17,8 +17,23 @@ namespace Test {
                        ival = blah;
                }
        }
+
+       public class My3Attribute : Attribute {
+               char[] array_val;
+
+               public char[] Prop {
+                       get {
+                               return array_val;
+                       }
+                       set {
+                               array_val = value;
+                       }
+               }
+       }
+                       
        [My("testclass")]
        [My2("testclass", 22)]
+       [My3(Prop = new char [] { 'A', 'B', 'C' })]
        public class Test {
                static public int Main() {
                        System.Reflection.MemberInfo info = typeof (Test);
@@ -26,11 +41,18 @@ namespace Test {
                        for (int i = 0; i < attributes.Length; i ++) {
                                System.Console.WriteLine(attributes[i]);
                        }
-                       if (attributes.Length != 2)
+                       if (attributes.Length != 3)
                                return 1;
-                       MyAttribute attr = (MyAttribute) attributes [0];
-                       if (attr.val != "testclass")
-                               return 2;
+                       for (int i = 0; i < attributes.Length; ++i) {
+                               if (attributes [i] is MyAttribute) {
+                                       if (((MyAttribute)attributes [i]).val != "testclass")
+                                               return 2;
+                               }
+                               if (attributes [i] is My3Attribute) {
+                                       if (new String (((My3Attribute)attributes [i]).Prop) != "ABC")
+                                               return 3;
+                               }
+                       }
                        return 0;
                }
        }