Author: zoltan
Date: 2007-09-14 10:41:02 -0400 (Fri, 14 Sep 2007)
New Revision: 85804

Modified:
   trunk/mcs/class/corlib/Test/System.Runtime.InteropServices/ChangeLog
   trunk/mcs/class/corlib/Test/System.Runtime.InteropServices/GCHandleTest.cs
Log:
2007-09-14  Zoltan Varga  <[EMAIL PROTECTED]>

        * GCHandleTest.cs: Add some tests.


Modified: trunk/mcs/class/corlib/Test/System.Runtime.InteropServices/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Runtime.InteropServices/ChangeLog        
2007-09-14 14:40:30 UTC (rev 85803)
+++ trunk/mcs/class/corlib/Test/System.Runtime.InteropServices/ChangeLog        
2007-09-14 14:41:02 UTC (rev 85804)
@@ -1,3 +1,7 @@
+2007-09-14  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * GCHandleTest.cs: Add some tests.
+
 2007-08-23  Robert Jordan  <[EMAIL PROTECTED]>
 
        * MarshalTest.cs: Added test for HGlobal allocations. See bug #82499.

Modified: 
trunk/mcs/class/corlib/Test/System.Runtime.InteropServices/GCHandleTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.Runtime.InteropServices/GCHandleTest.cs  
2007-09-14 14:40:30 UTC (rev 85803)
+++ trunk/mcs/class/corlib/Test/System.Runtime.InteropServices/GCHandleTest.cs  
2007-09-14 14:41:02 UTC (rev 85804)
@@ -31,6 +31,57 @@
                        GCHandle gch = (GCHandle)ptr;
                }
 
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void AddrOfPinnedObjectNormal ()
+               {
+                       GCHandle handle = GCHandle.Alloc (new Object (), 
GCHandleType.Normal);
+                       try {
+                               IntPtr ptr = handle.AddrOfPinnedObject();
+                       }
+                       finally {
+                               handle.Free();
+                       }
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void AddrOfPinnedObjectWeak ()
+               {
+                       GCHandle handle = GCHandle.Alloc (new Object (), 
GCHandleType.Weak);
+                       try {
+                               IntPtr ptr = handle.AddrOfPinnedObject();
+                       }
+                       finally {
+                               handle.Free();
+                       }
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException))]
+               public void AddrOfPinnedObjectWeakTrackResurrection ()
+               {
+                       GCHandle handle = GCHandle.Alloc (new Object (), 
GCHandleType.WeakTrackResurrection);
+                       try {
+                               IntPtr ptr = handle.AddrOfPinnedObject();
+                       }
+                       finally {
+                               handle.Free();
+                       }
+               }
+
+               [Test]
+               public void AddrOfPinnedObjectNull ()
+               {
+                       GCHandle handle = GCHandle.Alloc (null, 
GCHandleType.Pinned);
+                       try {
+                               IntPtr ptr = handle.AddrOfPinnedObject();
+                               AssertEquals (new IntPtr (0), ptr);
+                       }
+                       finally {
+                               handle.Free();
+                       }
+               }
        }
 }
 

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

Reply via email to