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

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2019-10-04 12:40:17 +0300
committerMarek Safar <marek.safar@gmail.com>2019-10-04 19:31:07 +0300
commite8fea0e48e63e3e5706246b28efd6ef935c5c58c (patch)
tree6652bcc6c8e8cd024da389f6e6b9e1ee9e3d7d31 /test
parent699cea5a5b25e5fc094b89beed0fd0daca5f42e1 (diff)
Add detection for single member lookup methods in RuntimeReflectionExtensions
Fixes #55
Diffstat (limited to 'test')
-rw-r--r--test/Mono.Linker.Tests.Cases/Reflection/RuntimeReflectionExtensionsCalls.cs63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Reflection/RuntimeReflectionExtensionsCalls.cs b/test/Mono.Linker.Tests.Cases/Reflection/RuntimeReflectionExtensionsCalls.cs
new file mode 100644
index 000000000..16d19dad9
--- /dev/null
+++ b/test/Mono.Linker.Tests.Cases/Reflection/RuntimeReflectionExtensionsCalls.cs
@@ -0,0 +1,63 @@
+using System;
+using Mono.Linker.Tests.Cases.Expectations.Assertions;
+using System.Reflection;
+
+namespace Mono.Linker.Tests.Cases.Reflection
+{
+ public class RuntimeReflectionExtensionsCalls
+ {
+ public static void Main ()
+ {
+ TestGetRuntimeEvent ();
+ TestGetRuntimeField ();
+ TestGetRuntimeProperty ();
+
+ TestGetRuntimeMethod ();
+ }
+
+ [Kept]
+ public static void TestGetRuntimeEvent ()
+ {
+ typeof (Foo).GetRuntimeEvent ("Event");
+ }
+
+ [Kept]
+ public static void TestGetRuntimeField ()
+ {
+ typeof (Foo).GetRuntimeField ("Field");
+ }
+
+ [Kept]
+ public static void TestGetRuntimeProperty ()
+ {
+ typeof (Foo).GetRuntimeProperty ("Property");
+ }
+
+ [Kept]
+ public static void TestGetRuntimeMethod ()
+ {
+ typeof (Foo).GetRuntimeMethod ("Method1", Type.EmptyTypes);
+ }
+
+ class Foo
+ {
+ [Kept]
+ [KeptBackingField]
+ [KeptEventAddMethod]
+ [KeptEventRemoveMethod]
+ event EventHandler<EventArgs> Event;
+
+ [Kept]
+ int Field;
+
+ [Kept]
+ [KeptBackingField]
+ public long Property { [Kept] get; [Kept] set; }
+
+ [Kept]
+ public void Method1 (int someArg)
+ {
+ }
+ }
+ }
+}