[mcs] Pending implementation of accessors cannot hide base implementation with differ...
[mono.git] / mcs / tests / test-39.cs
1 using System;
2 [AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)]
3 public class SimpleAttribute : Attribute {
4         
5         string name = null;
6         
7         public string MyNamedArg;
8         
9         private string secret;
10         
11         public SimpleAttribute (string name)
12         {
13                 this.name = name;
14         }
15         
16         public string AnotherArg {
17                 get {
18                         return secret;
19                 }
20                 set {
21                         secret = value;
22                 }
23         }
24                 
25         public long LongValue {
26                 get {
27                         return 0;
28                 }
29                 set { }
30         }
31         
32         public long[] ArrayValue {
33                 get {
34                         return new long[0];
35                 }
36                 set { }
37         }
38         
39         public object D;
40 }
41
42 [Simple ("Interface test")]
43 public interface IFoo {
44         void MethodOne (int x, int y);
45         bool MethodTwo (float x, float y);
46 }
47
48 [Simple ("Fifth", D=new double[] { -1 })]
49 class Blah2
50 {
51 }
52
53 [Simple ("Fifth", D=new double[0])]
54 class Blah3
55 {
56 }
57
58 [Simple ("Dummy", MyNamedArg = "Dude!")]
59 [Simple ("Vids", MyNamedArg = "Raj", AnotherArg = "Foo")]
60 [Simple ("Trip", LongValue=0)]
61 [Simple ("Fourth", ArrayValue=new long[] { 0 })]
62 public class Blah {
63
64         public static int Main ()
65         {
66                                 object o = (((SimpleAttribute)typeof(Blah2).GetCustomAttributes (typeof (SimpleAttribute), false)[0]).D);
67                                 if (o.ToString () != "System.Double[]")
68                                         return 1;
69
70                                 if (((double[])o)[0].GetType () != typeof (double))
71                                         return 2;
72
73                                 o = (((SimpleAttribute)typeof(Blah3).GetCustomAttributes (typeof (SimpleAttribute), false)[0]).D);
74                                 if (o.ToString () != "System.Double[]")
75                                         return 3;
76                                 
77                                 Console.WriteLine ("OK");
78                 return 0;
79         }
80 }