Author: marek
Date: 2005-03-30 07:51:01 -0500 (Wed, 30 Mar 2005)
New Revision: 42371

Added:
   trunk/mcs/tests/cond-attr.cs
Modified:
   trunk/mcs/tests/ChangeLog
   trunk/mcs/tests/Makefile
Log:
2005-03-30  Marek Safar <[EMAIL PROTECTED]>

        * cond-attr.cs.cs: Conditional attribute class test.

Modified: trunk/mcs/tests/ChangeLog
===================================================================
--- trunk/mcs/tests/ChangeLog   2005-03-30 12:45:39 UTC (rev 42370)
+++ trunk/mcs/tests/ChangeLog   2005-03-30 12:51:01 UTC (rev 42371)
@@ -1,3 +1,7 @@
+2005-03-30  Marek Safar <[EMAIL PROTECTED]>
+
+       * cond-attr.cs.cs: Conditional attribute class test.
+
 2005-03-16  Raja R Harinath  <[EMAIL PROTECTED]>
 
        * a-capture6.cs, a-nested.cs: Fix compilation.

Modified: trunk/mcs/tests/Makefile
===================================================================
--- trunk/mcs/tests/Makefile    2005-03-30 12:45:39 UTC (rev 42370)
+++ trunk/mcs/tests/Makefile    2005-03-30 12:51:01 UTC (rev 42371)
@@ -122,7 +122,9 @@
        gen-111 gen-112 gen-113 gen-114 gen-115 gen-116 gen-117 gen-118 gen-119 
gen-120 \
        gen-121 gen-122 gen-123 gen-124 gen-125         gen-127 gen-128 gen-129 
gen-130 \
        gen-131 gen-132 gen-133 gen-134 gen-135 gen-136 gen-137 gen-138 gen-139 
gen-140 \
-       gen-141 gen-142 gen-143 gen-144 gen-145
+       gen-141 gen-142 gen-143 gen-144 gen-145 
+# Need mcs merge
+#      cond-attr fixed-buffer-dll fixed-buffer-exe
 
 # gen-72 fails after the runtime changes in r40305
 TEST_EXCLUDES_net_2_0 = $(NEW_TEST_SOURCES_common) gen-72

Added: trunk/mcs/tests/cond-attr.cs
===================================================================
--- trunk/mcs/tests/cond-attr.cs        2005-03-30 12:45:39 UTC (rev 42370)
+++ trunk/mcs/tests/cond-attr.cs        2005-03-30 12:51:01 UTC (rev 42371)
@@ -0,0 +1,46 @@
+#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;
+    }
+}

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to