Merge pull request #3563 from lewurm/interpreter
[mono.git] / mcs / tests / test-492.cs
1 using System;
2 using System.Reflection;
3
4 namespace Test {
5         [AttributeUsage (AttributeTargets.All, AllowMultiple = true)]
6         public class My1Attribute : Attribute
7         {
8                 public My1Attribute (object o)
9                 {
10                         if (o != null)
11                                 throw new ApplicationException ();
12                 }
13         }
14
15         public class My2Attribute : Attribute
16         {
17                 public My2Attribute (string[] s)
18                 {
19                         if (s.Length != 0)
20                                 throw new ApplicationException ();
21                 }
22         }
23
24         public class My3Attribute : Attribute
25         {
26                 public My3Attribute (byte b)
27                 {
28                         if (b != 0xFF)
29                                 throw new ApplicationException ();
30                 }
31         }
32
33         
34         [My3(unchecked((byte)-1))]
35         [My1((object)null)]
36         [My1(null)]
37         [My2(new string[0])]
38         public class Test {
39                 public static int Main() {
40                         System.Reflection.MemberInfo info = typeof (Test);
41                         object[] attributes = info.GetCustomAttributes (false);
42                         
43                         if (attributes.Length != 4)
44                                 return 1;
45
46                         for (int i = 0; i < attributes.Length; i ++) {
47                                 Console.WriteLine (attributes [i]);
48                         }
49                         
50                         return 0;
51                 }
52         }
53 }