Merge pull request #5675 from mono/glib-debug-symbols
[mono.git] / mcs / tests / test-504.cs
1 // This ensures that any "unreachable code" warning will error out
2 // rather than generate invalid IL or crash compiler
3
4 using System;
5
6 public enum FooEnum
7 {
8         One,
9         Two
10 };
11
12 class Foo
13 {
14         public static int y = 1;
15         public static int f () { return 0; }
16         public static int Main ()
17         {
18                 int x;
19
20                 do {
21                         x = f ();
22                         if (x != 0)
23                                 continue;
24                         return 0;
25                 } while (x > y);
26
27                 return 1;
28         }
29
30         public static string Test_2 ()
31         {
32                 throw new Exception ();
33
34                 var account = "yo";
35                 if (account == null) {
36                 }
37
38                 var s = "yo";
39
40                 switch (8) {
41                 case 1:
42                 case 2:
43                         break;
44                 default:
45                         throw new NotSupportedException ();
46                 }
47
48                 return s;
49         }
50
51         const FooEnum foo = FooEnum.Two;
52
53         static void Test_3 ()
54         {
55                 object obj;
56
57                 switch (foo) {
58                 case FooEnum.One:
59                         obj = new object ();
60                         break;
61                 case FooEnum.Two:
62                         obj = new object ();
63                         break;
64                 }
65
66                 Console.WriteLine (obj);
67         }
68 }