2004-05-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / tests / test-19.cs
index c42af6f03b90e3de1e4bb1371d35e819c339c1a2..f63dff5295805505f56bb0939eae68308119929d 100755 (executable)
@@ -51,6 +51,7 @@ class X {
        {
                I.GetTextFn _ = I.GetText;
 
+       Console.WriteLine ("Value: " + I.GetText);
                X x = new X ();
 
                Thread thr = new Thread (new ThreadStart (x.Thread_func));
@@ -70,11 +71,44 @@ class X {
                MemberInfo [] mi = t.FindMembers (MemberTypes.Method, BindingFlags.Static | BindingFlags.NonPublic,
                                                  Type.FilterName, "MyFilter");
 
+               Console.WriteLine ("FindMembers called, mi = " + mi);
+               Console.WriteLine ("   Count: " + mi.Length);
                if (!filter (mi [0], "MyFilter"))
                        return 1;
+
+               //
+               // This test is used to call into a delegate defined in a separate
+               // namespace, but which is still not a nested delegate inside a class
+               //
+               NameSpace.TestDelegate td = new NameSpace.TestDelegate (multiply_by_three);
+
+               if (td (8) != 24)
+                       return 30;
+
+               //
+               // Check the names that were used to define the delegates
+               //
+               if (td.GetType ().FullName != "NameSpace.TestDelegate")
+                       return 31;
+
+               if (_.GetType ().FullName != "I+GetTextFn")
+                       return 32;
                
                Console.WriteLine ("Test passes");
 
                return 0;
        }
+
+       static int multiply_by_three (int v)
+       {
+               return v * 3;
+       }
+       
+}
+
+namespace NameSpace {
+
+       public delegate int TestDelegate (int a);
+
 }
+