summaryrefslogtreecommitdiff
path: root/mcs/tests/gtest-167.cs
blob: 304cec422b950ff3f153067b8ccf43741d7274cf (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
// Conditional attribute class test
#define DEBUG

using System;
using System.Diagnostics;

[Conditional("DEBUG")]
public class TestAttribute : Attribute {}

[Conditional("RELEASE")]
public class TestNotAttribute : Attribute {}

[Conditional("A")]
[Conditional("DEBUG")]    
[Conditional("B")]
public class TestMultiAttribute : Attribute {}
    
// TestAttribute is included
[Test]				
class Class1 {}
    
// TestNotAttribute is not included
[TestNot] 			
class Class2 {}

// Is included    
[TestMulti]
class Class3 {}


public class TestClass
{
    public static int Main ()
    {
	if (Attribute.GetCustomAttributes (typeof (Class1)).Length != 1)
		return 1;

	if (Attribute.GetCustomAttributes (typeof (Class2)).Length != 0)
		return 1;

	if (Attribute.GetCustomAttributes (typeof (Class3)).Length != 1)
		return 1;
	
	Console.WriteLine ("OK");
	return 0;
    }
}