2007-11-16 Marek Safar <marek.safar@gmail.com>
[mono.git] / mcs / tests / test-39.cs
index 52f243c62f0bca66f20e0278fda99cb667c0ac69..72035a58c90286088b12e98c6f0a3a5a65912e37 100644 (file)
@@ -21,7 +21,22 @@ public class SimpleAttribute : Attribute {
                         secret = value;
                 }
         }
-        
+               
+       public long LongValue {
+               get {
+                       return 0;
+               }
+               set { }
+       }
+       
+       public long[] ArrayValue {
+               get {
+                       return new long[0];
+               }
+               set { }
+       }
+       
+       public object D;
 }
 
 [Simple ("Interface test")]
@@ -30,15 +45,36 @@ public interface IFoo {
         bool MethodTwo (float x, float y);
 }
 
+[Simple ("Fifth", D=new double[] { -1 })]
+class Blah2
+{
+}
+
+[Simple ("Fifth", D=new double[0])]
+class Blah3
+{
+}
+
 [Simple ("Dummy", MyNamedArg = "Dude!")]
-[Simple ("Vids", MyNamedArg = "Raj", AnotherArg = "Foo")]      
+[Simple ("Vids", MyNamedArg = "Raj", AnotherArg = "Foo")]
+[Simple ("Trip", LongValue=0)]
+[Simple ("Fourth", ArrayValue=new long[] { 0 })]
 public class Blah {
 
         public static int Main ()
         {
-                Console.WriteLine ("A dummy app which tests attribute emission");
+                               object o = (((SimpleAttribute)typeof(Blah2).GetCustomAttributes (typeof (SimpleAttribute), false)[0]).D);
+                               if (o.ToString () != "System.Double[]")
+                                       return 1;
+
+                               if (((double[])o)[0].GetType () != typeof (double))
+                                       return 2;
+
+                               o = (((SimpleAttribute)typeof(Blah3).GetCustomAttributes (typeof (SimpleAttribute), false)[0]).D);
+                               if (o.ToString () != "System.Double[]")
+                                       return 3;
+                               
+                               Console.WriteLine ("OK");
                 return 0;
         }
 }
-
-