Add new tests
authorMarek Safar <marek.safar@gmail.com>
Fri, 25 Oct 2013 08:40:44 +0000 (10:40 +0200)
committerMarek Safar <marek.safar@gmail.com>
Fri, 25 Oct 2013 08:42:57 +0000 (10:42 +0200)
mcs/tests/gtest-217.cs [deleted file]
mcs/tests/gtest-381.cs [deleted file]
mcs/tests/gtest-iter-32.cs [new file with mode: 0644]
mcs/tests/gtest-iter-33.cs [new file with mode: 0644]
mcs/tests/test-873.cs [new file with mode: 0644]

diff --git a/mcs/tests/gtest-217.cs b/mcs/tests/gtest-217.cs
deleted file mode 100644 (file)
index bc86539..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-public delegate R Fun<A1,R>(A1 x);
-
-class MyTest {
-  public static void Main(String[] args) {
-    foreach (Object d in Map<int,int,String,Object>
-                           (delegate (int x) { return x.ToString(); }, 
-                            FromTo(10,20)))
-      Console.WriteLine(d);
-  }
-
-  // Map with argument/result co/contravariance:
-  // Aa=argument, Rr=result, Af=f's argument, Rf=f's result
-
-  public static IEnumerable<Rr> Map<Aa,Af,Rf,Rr>(Fun<Af,Rf> f, 
-                                                 IEnumerable<Aa> xs) 
-    where Aa : Af 
-    where Rf : Rr 
-  { 
-    foreach (Aa x in xs)
-      yield return f(x);    // gmcs 1.1.9 bug: cannot convert Aa to Af
-  }
-
-  // FromTo : int * int -> int stream
-
-  public static IEnumerable<int> FromTo(int from, int to) { 
-    for (int i=from; i<=to; i++)
-      yield return i;
-  }
-}
-
-
diff --git a/mcs/tests/gtest-381.cs b/mcs/tests/gtest-381.cs
deleted file mode 100644 (file)
index 04e80fe..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Collections.Generic;
-
-class TestGoto
-{
-  static int x = 2;
-
-  public static void Main(string[] args)
-    {
-      foreach (bool b in test())
-       ;
-      if (x != 0)
-       throw new System.Exception ();
-    }
-
-  static IEnumerable<bool> setX()
-  {
-    x = 1;
-    try {
-      yield return true;
-    } finally {
-      x = 0;
-    }
-  }
-
-  static IEnumerable<bool> test()
-  {
-    foreach (bool b in setX()) {
-      yield return true;
-      // Change "goto label" to "break" to show the correct result.
-      goto label;
-    }
-  label:
-    yield break;
-  }
-}
diff --git a/mcs/tests/gtest-iter-32.cs b/mcs/tests/gtest-iter-32.cs
new file mode 100644 (file)
index 0000000..04e80fe
--- /dev/null
@@ -0,0 +1,35 @@
+using System.Collections.Generic;
+
+class TestGoto
+{
+  static int x = 2;
+
+  public static void Main(string[] args)
+    {
+      foreach (bool b in test())
+       ;
+      if (x != 0)
+       throw new System.Exception ();
+    }
+
+  static IEnumerable<bool> setX()
+  {
+    x = 1;
+    try {
+      yield return true;
+    } finally {
+      x = 0;
+    }
+  }
+
+  static IEnumerable<bool> test()
+  {
+    foreach (bool b in setX()) {
+      yield return true;
+      // Change "goto label" to "break" to show the correct result.
+      goto label;
+    }
+  label:
+    yield break;
+  }
+}
diff --git a/mcs/tests/gtest-iter-33.cs b/mcs/tests/gtest-iter-33.cs
new file mode 100644 (file)
index 0000000..bc86539
--- /dev/null
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+
+public delegate R Fun<A1,R>(A1 x);
+
+class MyTest {
+  public static void Main(String[] args) {
+    foreach (Object d in Map<int,int,String,Object>
+                           (delegate (int x) { return x.ToString(); }, 
+                            FromTo(10,20)))
+      Console.WriteLine(d);
+  }
+
+  // Map with argument/result co/contravariance:
+  // Aa=argument, Rr=result, Af=f's argument, Rf=f's result
+
+  public static IEnumerable<Rr> Map<Aa,Af,Rf,Rr>(Fun<Af,Rf> f, 
+                                                 IEnumerable<Aa> xs) 
+    where Aa : Af 
+    where Rf : Rr 
+  { 
+    foreach (Aa x in xs)
+      yield return f(x);    // gmcs 1.1.9 bug: cannot convert Aa to Af
+  }
+
+  // FromTo : int * int -> int stream
+
+  public static IEnumerable<int> FromTo(int from, int to) { 
+    for (int i=from; i<=to; i++)
+      yield return i;
+  }
+}
+
+
diff --git a/mcs/tests/test-873.cs b/mcs/tests/test-873.cs
new file mode 100644 (file)
index 0000000..abe3b3b
--- /dev/null
@@ -0,0 +1,28 @@
+using System;
+
+class Program
+{
+       static int Main ()
+       {
+               int foo = 9;
+
+               switch (foo) {
+               case 1:
+                       gotoTarget: 
+                       {
+                               return 0;
+                       }
+               default:
+                       {
+                               if (foo != 0) {
+                                       goto gotoTarget;
+                               }
+
+                               break;
+                       }
+               }
+
+               return 1;
+       }
+}
+