Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

48 lines
868 B
C#

// 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;
}
}