New test.
[mono.git] / mcs / tests / test-154.cs
index f647492949b34bb86903c780fcf30867c9ddc84d..8098cfd5bcabaa322a1a92d3491e5722859ee6c7 100644 (file)
@@ -294,7 +294,7 @@ public class X
                 } finally {
                         fin = 1;
                 }
-                return res;
+                return fin;
         }
 
        // from bug #30487.
@@ -435,7 +435,7 @@ public class X
        //
        // Bug #47095
        //
-       static bool method (out int a)
+       static bool test29 (out int a)
        {
                try {
                        a = 0;
@@ -445,4 +445,153 @@ public class X
                        return false;
                }
        }
+
+       //
+       // Bug #46949
+       //
+       public string test30 (out string outparam)
+       {
+               try {
+                       if (true) {
+                               outparam = "";
+                               return "";
+                       }
+               } catch {
+               }
+
+               outparam = null;
+               return null;
+       }
+
+       //
+       // Bug #49153
+       //
+       public string test31 (int blah)
+       {
+               switch(blah) {
+               case 1: return("foo"); break;
+               case 2: return("bar"); break;
+               case 3: return("baz"); break;
+
+               default:
+                       throw new ArgumentException ("Value 0x"+blah.ToString ("x4")+" is not supported.");
+               }
+       }
+
+       //
+       // Bug #49359
+       //
+        public void test32 ()
+       {
+                while (true) {
+                        System.Threading.Thread.Sleep (1);
+                }
+
+                Console.WriteLine ("Hello");
+        }
+
+       //
+       // Bug 49602
+       //
+        public int test33 ()
+        {
+                int i = 0;
+                return 0;
+                if (i == 0)
+                        return 0;
+        }
+
+       //
+       // Bug 48962
+       //
+       public void test34 ()
+       {
+               int y, x = 3;
+               if (x > 3) {
+                       y = 3;
+                       goto end;
+               }
+               return;
+        end:
+               x = y;
+       }
+
+       //
+       // Bug 46640
+       //
+       public static void test35 (int a, bool test)
+       {
+               switch (a) {
+               case 3:
+                       if (test)
+                               break;
+                       return;
+               default:
+                       return;
+               }
+       }
+
+       //
+       // Bug 52625
+       //
+       public static void test36 ()
+       {
+               string myVar;
+               int counter = 0;
+
+               while (true)
+               {
+                       if (counter < 3)
+                               counter++;
+                       else {
+                               myVar = "assigned";
+                               break;
+                       }
+               }
+               Console.WriteLine (myVar);
+       }
+
+       //
+       // Bug 58322
+       //
+       public static void test37 ()
+       {
+               int x = 0;
+               int y = 0;
+               switch (x) {
+               case 0:
+                       switch (y) {
+                       case 0:
+                               goto k_0;
+                       default:
+                               throw new Exception ();
+                       }
+               }
+
+       k_0:
+               ;
+       }
+
+       //
+       // Bug 59429
+       //
+       public static int test38 ()
+       {
+               return 0;
+       foo:
+               ;
+       }
+
+       static int test40 (int stop)
+       {
+               int service;
+
+               int pos = 0;
+               do {
+                       service = 1;
+                       break;
+               } while (pos < stop);
+
+               return service;
+       }
 }