Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-39.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 72035a58c90286088b12e98c6f0a3a5a65912e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System;
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)]
public class SimpleAttribute : Attribute {
        
        string name = null;
        
        public string MyNamedArg;
        
        private string secret;
        
        public SimpleAttribute (string name)
        {
                this.name = name;
        }
        
        public string AnotherArg {
                get {
                        return secret;
                }
                set {
                        secret = value;
                }
        }
		
	public long LongValue {
		get {
			return 0;
		}
		set { }
	}
	
	public long[] ArrayValue {
		get {
			return new long[0];
		}
		set { }
	}
	
	public object D;
}

[Simple ("Interface test")]
public interface IFoo {
        void MethodOne (int x, int y);
        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 ("Trip", LongValue=0)]
[Simple ("Fourth", ArrayValue=new long[] { 0 })]
public class Blah {

        public static int Main ()
        {
				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;
        }
}