[System.Core] SLE from CoreFX including interpreter
[mono.git] / mcs / tests / test-anon-35.cs
1 using System;
2
3 public class ExceptionWithAnonMethod
4 {
5         public delegate void EmptyCallback();
6         static string res;
7         
8         public static int Main()
9         {
10                 try {
11                         throw new Exception("e is afraid to enter anonymous land");
12                 } catch(Exception e) {
13                         AnonHandler(delegate {
14                                 Console.WriteLine(e.Message); 
15                                 res = e.Message;
16                         });
17                 }
18                 if (res == "e is afraid to enter anonymous land"){
19                     Console.WriteLine ("Test passed");
20                     return 0;
21                 }
22                 Console.WriteLine ("Test failed");
23                 return 1;
24         }
25
26         public static void AnonHandler(EmptyCallback handler)
27         {
28                 if(handler != null) {
29                         handler();
30                 }
31         }
32 }