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

github.com/mono/cecil.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Test/Mono.Cecil.Tests/ImportReflectionTests.cs')
-rw-r--r--Test/Mono.Cecil.Tests/ImportReflectionTests.cs35
1 files changed, 21 insertions, 14 deletions
diff --git a/Test/Mono.Cecil.Tests/ImportReflectionTests.cs b/Test/Mono.Cecil.Tests/ImportReflectionTests.cs
index 0476861..c99ca4f 100644
--- a/Test/Mono.Cecil.Tests/ImportReflectionTests.cs
+++ b/Test/Mono.Cecil.Tests/ImportReflectionTests.cs
@@ -1,7 +1,6 @@
#if !READ_ONLY
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.IO;
using SR = System.Reflection;
using System.Runtime.CompilerServices;
@@ -156,6 +155,9 @@ namespace Mono.Cecil.Tests {
[Test]
public void ImportGenericField ()
{
+ if (Platform.OnCoreClr)
+ return;
+
var get_field = Compile<Func<Generic<string>, string>> ((module, body) => {
var il = body.GetILProcessor ();
il.Emit (OpCodes.Ldarg_0);
@@ -173,6 +175,9 @@ namespace Mono.Cecil.Tests {
[Test]
public void ImportGenericMethod ()
{
+ if (Platform.OnCoreClr)
+ return;
+
var generic_identity = Compile<Func<Generic<int>, int, int>> ((module, body) => {
var il = body.GetILProcessor ();
il.Emit (OpCodes.Ldarg_0);
@@ -187,6 +192,9 @@ namespace Mono.Cecil.Tests {
[Test]
public void ImportGenericMethodSpec ()
{
+ if (Platform.OnCoreClr)
+ return;
+
var gen_spec_id = Compile<Func<Generic<string>, int, int>> ((module, body) => {
var il = body.GetILProcessor ();
il.Emit (OpCodes.Ldarg_0);
@@ -202,6 +210,9 @@ namespace Mono.Cecil.Tests {
[Test]
public void ImportComplexGenericMethodSpec ()
{
+ if (Platform.OnCoreClr)
+ return;
+
var gen_spec_id = Compile<Func<Generic<string>, int, int>> ((module, body) => {
var il = body.GetILProcessor ();
il.Emit (OpCodes.Ldarg_0);
@@ -279,6 +290,9 @@ namespace Mono.Cecil.Tests {
[Test]
public void ImportGenericFieldFromContext ()
{
+ if (Platform.OnCoreClr)
+ return;
+
var list_foo = typeof (Foo<>).GetField ("list").FieldType;
var generic_list_foo_open = typeof (Generic<>).MakeGenericType (list_foo);
var generic_list_foo_open_field = generic_list_foo_open.GetField ("Field");
@@ -295,6 +309,9 @@ namespace Mono.Cecil.Tests {
[Test]
public void ImportGenericMethodFromContext ()
{
+ if (Platform.OnCoreClr)
+ return;
+
var list_foo = typeof (Foo<>).GetField ("list").FieldType;
var generic_list_foo_open = typeof (Generic<>).MakeGenericType (list_foo);
var generic_list_foo_open_method = generic_list_foo_open.GetMethod ("Method");
@@ -334,11 +351,10 @@ namespace Mono.Cecil.Tests {
delegate void Emitter (ModuleDefinition module, MethodBody body);
- [MethodImpl (MethodImplOptions.NoInlining)]
- static TDelegate Compile<TDelegate> (Emitter emitter)
+ static TDelegate Compile<TDelegate> (Emitter emitter, [CallerMemberName] string testMethodName = null)
where TDelegate : class
{
- var name = GetTestCaseName ();
+ var name = "ImportReflection_" + testMethodName;
var module = CreateTestModule<TDelegate> (name, emitter);
var assembly = LoadTestModule (module);
@@ -409,15 +425,6 @@ namespace Mono.Cecil.Tests {
{
return ModuleDefinition.CreateModule (name, ModuleKind.Dll);
}
-
- [MethodImpl (MethodImplOptions.NoInlining)]
- static string GetTestCaseName ()
- {
- var stack_trace = new StackTrace ();
- var stack_frame = stack_trace.GetFrame (2);
-
- return "ImportReflection_" + stack_frame.GetMethod ().Name;
- }
}
}
-#endif \ No newline at end of file
+#endif