Put back gtest-126.cs
[mono.git] / mcs / tests / test-149.cs
index 824ed56ef4d3a99fe253b2d0e179a7c412985e2b..32a9c19846e9cac7b39c1747e017a67e14644ce4 100644 (file)
@@ -42,10 +42,10 @@ public class Y : X
                        return 2;
 
                if (TestEvent (2) != 4)
-                       return 2;
+                       return 3;
 
                if (a != 2)
-                       return 3;
+                       return 4;
 
                return 0;
        }
@@ -70,14 +70,43 @@ public class Y : X
 
 public class Z : Y
 {
+       public delegate int SomeEventHandler();
+        public static event SomeEventHandler BuildStarted;
+
+       static int a ()
+       {
+               return 1;
+       }
        public static int Main ()
        {
                Z z = new Z ();
 
                int result = z.Test ();
 
-               Console.WriteLine ("TEST RESULT: " + result);
+               if (result != 0)
+                       return result;
 
-               return result;
+               if (BuildStarted != null) {
+                       BuildStarted();
+               }
+               BuildStarted = new SomeEventHandler (a);
+               if (BuildStarted () != 1)
+                       return 50; 
+
+               return 0;
+       }
+}
+
+//
+// This class is just to test a bug in mcs; where we used to fail
+// when accessing a static event, from an instance method.
+//
+public class Static {
+       public static event EventHandler Test;
+                       
+       public void Fire()
+       {
+               if ( Test != null )
+                       Test (null, null);
        }
 }