add test to confirm behavior of Control.SetVisibleCore, and remove some redundant...
[mcs.git] / tests / test-297.cs
blob26a487a17a559640031387c928648384c0878eb6
1 using System;
3 [My((long)1)]
4 [My(TypeCode.Empty)]
5 [My(typeof(System.Enum))]
6 class T {
7 static int Main() {
8 object[] a = Attribute.GetCustomAttributes (typeof (T), false);
9 if (a.Length != 3)
10 return 1;
11 foreach (object o in a) {
12 My attr = (My)o;
13 if (attr.obj.GetType () == typeof (long)) {
14 long val = (long) attr.obj;
15 if (val != 1)
16 return 2;
17 } else if (attr.obj.GetType () == typeof (TypeCode)) {
18 TypeCode val = (TypeCode) attr.obj;
19 if (val != TypeCode.Empty)
20 return 3;
21 } else if (attr.obj.GetType ().IsSubclassOf (typeof (Type))) {
22 Type val = (Type) attr.obj;
23 if (val != typeof (System.Enum))
24 return 4;
25 } else
26 return 5;
30 object[] ats = typeof(T).GetMethod("Login").GetCustomAttributes (typeof(My), true);
31 My at = (My) ats[0];
32 if (at.Val != AnEnum.a)
33 return 6;
35 return 0;
38 [My(1, Val=AnEnum.a)]
39 public void Login(string a) {}
42 [AttributeUsage(AttributeTargets.All,AllowMultiple=true)]
43 class My : Attribute {
44 public object obj;
45 public My (object o) {
46 obj = o;
49 public AnEnum Val;
52 public enum AnEnum
54 a,b,c