Imported Upstream version 5.8.0.88

Former-commit-id: 4b7216ffda08448e562271ce733688e761120fc5
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-11-28 19:36:51 +00:00
parent 7d05485754
commit 6123a772ed
277 changed files with 4817 additions and 941 deletions

View File

@@ -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
#endif