Author: marek
Date: 2007-11-09 10:46:59 -0500 (Fri, 09 Nov 2007)
New Revision: 89322

Modified:
   trunk/mcs/tests/gtest-117.cs
   trunk/mcs/tests/test-123.cs
Log:
New tests.



Modified: trunk/mcs/tests/gtest-117.cs
===================================================================
--- trunk/mcs/tests/gtest-117.cs        2007-11-09 15:25:53 UTC (rev 89321)
+++ trunk/mcs/tests/gtest-117.cs        2007-11-09 15:46:59 UTC (rev 89322)
@@ -1,3 +1,5 @@
+// Compiler options: -warnaserror
+
 using System;
 
 public interface IFoo<T>
@@ -9,12 +11,63 @@
        {
                return x is IFoo<T>;
        }
+       
+       public static bool Test ()
+       {
+               T t = default (T);
+               return t is int;
+       }
+       
+       public static bool TestB ()
+       {
+               T t = default (T);
+               return t is int?;
+       }
 }
 
+class Y<T> where T : struct
+{
+       public bool Foo ()
+       {
+               object o = null;
+               return o is System.Nullable <T>;
+       }
+}
+
 class X
 {
-       static void Main ()
+       public static bool TestA (object o)
        {
-               Foo<int>.Test (3);
+               return o is int?;
        }
+       
+       public static bool TestB<T> (T o)
+       {
+               return o is int[];
+       }
+       
+       static int Main ()
+       {
+               if (Foo<int>.Test (3))
+                       return 1;
+               
+               if (!Foo<int>.Test())
+                       return 2;
+               
+               // False expected int? != null
+               if (Foo<int?>.TestB())
+                       return 3;
+
+               int? i = 0;
+               if (!TestA(i))
+                       return 4;
+               
+               int[] a = new int[0];
+               if (!TestB(a))
+                       return 5;
+               
+               Console.WriteLine ("OK");
+               return 0;
+       }
 }
+

Modified: trunk/mcs/tests/test-123.cs
===================================================================
--- trunk/mcs/tests/test-123.cs 2007-11-09 15:25:53 UTC (rev 89321)
+++ trunk/mcs/tests/test-123.cs 2007-11-09 15:46:59 UTC (rev 89322)
@@ -40,6 +40,10 @@
 
                if (d is int)
                        return 6;
+                       
+               object oi = 1;
+               if (!(oi is int))
+                       return 7;
 
                System.Console.WriteLine ("Is tests pass");
                return 0;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to