Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/Simple/Delegates/Delegates.cs')
-rw-r--r--tests/src/Simple/Delegates/Delegates.cs21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/src/Simple/Delegates/Delegates.cs b/tests/src/Simple/Delegates/Delegates.cs
index 1271eb9b3..d17133dfe 100644
--- a/tests/src/Simple/Delegates/Delegates.cs
+++ b/tests/src/Simple/Delegates/Delegates.cs
@@ -4,6 +4,8 @@
using System;
+using Pointer = System.Reflection.Pointer;
+
public class BringUpTests
{
const int Pass = 100;
@@ -105,6 +107,14 @@ public class BringUpTests
return false;
}
+ {
+ // This will end up being a delegate to a sealed virtual method.
+ ClassWithIFoo t = new ClassWithIFoo("Class");
+ Func<int, string> d = t.DoFoo;
+ if (d(987) != "Class987")
+ return false;
+ }
+
Console.WriteLine("OK");
return true;
}
@@ -247,7 +257,10 @@ public class BringUpTests
unsafe
{
GetAndReturnPointerDelegate d = ClassWithPointers.GetAndReturnPointer;
- if ((IntPtr)d.DynamicInvoke(new object[] { (IntPtr)8 }) != (IntPtr)50)
+ if (Pointer.Unbox(d.DynamicInvoke(new object[] { (IntPtr)8 })) != (void*)50)
+ return false;
+
+ if (Pointer.Unbox(d.DynamicInvoke(new object[] { Pointer.Box((void*)9, typeof(void*)) })) != (void*)51)
return false;
}
@@ -390,14 +403,14 @@ static class ExtensionClass
}
}
-unsafe delegate IntPtr GetAndReturnPointerDelegate(void* ptr);
+unsafe delegate byte* GetAndReturnPointerDelegate(void* ptr);
unsafe delegate void PassPointerByRefDelegate(ref void* ptr);
unsafe static class ClassWithPointers
{
- public static IntPtr GetAndReturnPointer(void* ptr)
+ public static byte* GetAndReturnPointer(void* ptr)
{
- return (IntPtr)((byte*)ptr + 42);
+ return (byte*)ptr + 42;
}
public static void PassPointerByRef(ref void* ptr)