Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@ -33,7 +33,7 @@ using NUnit.Framework;
using System;
using System.Threading;
using System.Reflection;
#if !MONOTOUCH
#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.Runtime.InteropServices;
@ -54,7 +54,7 @@ namespace MonoTests.System.Reflection
[TestFixture]
public class MethodInfoTest
{
#if MONOTOUCH
#if MONOTOUCH || MOBILE_STATIC
// use an existing symbol - so we can build without dlsym. It does not matter that the signature does not match for the test
[DllImport ("libc", EntryPoint="readlink", CharSet=CharSet.Unicode, ExactSpelling=false, PreserveSig=true, SetLastError=true, BestFitMapping=true, ThrowOnUnmappableChar=true)]
#else
@ -115,7 +115,7 @@ namespace MonoTests.System.Reflection
DllImportAttribute attr = (DllImportAttribute)((t.GetMethod ("dllImportMethod").GetCustomAttributes (typeof (DllImportAttribute), true)) [0]);
Assert.AreEqual (CallingConvention.Winapi, attr.CallingConvention, "#1");
#if MONOTOUCH
#if MONOTOUCH || MOBILE_STATIC
Assert.AreEqual ("readlink", attr.EntryPoint, "#2");
Assert.AreEqual ("libc", attr.Value, "#3");
#else
@ -308,6 +308,9 @@ namespace MonoTests.System.Reflection
public override void f2 () { }
}
class DerivedFromGenericBase : GenericBase<int, int> {
}
[Test]
public void GetBaseDefinition_OpenConstructedBaseType () // 36305
{
@ -394,7 +397,7 @@ namespace MonoTests.System.Reflection
[Test]
public void GetMethodBody ()
{
#if MONOTOUCH && !DEBUG
#if (MONOTOUCH || MOBILE_STATIC) && !DEBUG
Assert.Ignore ("Release app (on devices) are stripped of (managed) IL so this test would fail");
#endif
MethodBody mb = typeof (MethodInfoTest).GetMethod ("locals_method").GetMethodBody ();
@ -597,7 +600,7 @@ namespace MonoTests.System.Reflection
} catch (InvalidOperationException ex) {
}
}
#if !MONOTOUCH
#if !MONOTOUCH && !MOBILE_STATIC
public TFoo SimpleGenericMethod2<TFoo, TBar> () { return default (TFoo); }
/*Test for the uggly broken behavior of SRE.*/
[Test]
@ -824,7 +827,34 @@ namespace MonoTests.System.Reflection
Assert.AreEqual ("System.Nullable`1[System.Int32] Bug12856()", m.ToString (), "#1");
}
#if !MONOTOUCH
[Test]
public void GetReflectedType () // #12205
{
// public method declared in base type, queried from a derived type
MethodInfo mi = typeof (TestInheritedMethodB).GetMethod ("TestMethod2");
Assert.AreEqual (mi.ReflectedType, typeof (TestInheritedMethodB), "#1");
// public method declared in a generic class,
// queried from a non-generic class derived
// from an instantiation of the generic class.
mi = typeof (DerivedFromGenericBase).GetMethod ("f2");
Assert.AreEqual (mi.ReflectedType, typeof (DerivedFromGenericBase), "#2");
// public method declared in a generic class,
// queried from the generic type defintion of
// a generic derived class.
mi = typeof (GenericMid<,>).GetMethod ("f2");
Assert.AreEqual (mi.ReflectedType, typeof (GenericMid<,>), "#3");
// public method declared in a generic class,
// queried from an instantiation of a generic
// derived class.
mi = typeof (GenericMid<int,int>).GetMethod ("f2");
Assert.AreEqual (mi.ReflectedType, typeof (GenericMid<int,int>), "#4");
}
#if !MONOTOUCH && !MOBILE_STATIC
class GenericClass<T>
{
public void Method ()