Imported Upstream version 4.3.2.467

Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
Xamarin Public Jenkins
2016-02-22 11:00:01 -05:00
parent f302175246
commit f3e3aab35a
4097 changed files with 122406 additions and 82300 deletions

View File

@ -3,9 +3,11 @@
//
// Authors:
// Zoltan Varga (vargaz@gmail.com)
// Aleksey Kliger (aleksey@xamarin.com)
//
// (c) 2003 Ximian, Inc. (http://www.ximian.com)
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
// Copyright (C) 2015 Xamarin, Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@ -52,7 +54,12 @@ namespace MonoTests.System.Reflection
[TestFixture]
public class MethodInfoTest
{
#if MONOTOUCH
// 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
[DllImport ("libfoo", EntryPoint="foo", CharSet=CharSet.Unicode, ExactSpelling=false, PreserveSig=true, SetLastError=true, BestFitMapping=true, ThrowOnUnmappableChar=true)]
#endif
public static extern void dllImportMethod ();
[MethodImplAttribute(MethodImplOptions.PreserveSig)]
public void preserveSigMethod ()
@ -108,8 +115,13 @@ namespace MonoTests.System.Reflection
DllImportAttribute attr = (DllImportAttribute)((t.GetMethod ("dllImportMethod").GetCustomAttributes (typeof (DllImportAttribute), true)) [0]);
Assert.AreEqual (CallingConvention.Winapi, attr.CallingConvention, "#1");
#if MONOTOUCH
Assert.AreEqual ("readlink", attr.EntryPoint, "#2");
Assert.AreEqual ("libc", attr.Value, "#3");
#else
Assert.AreEqual ("foo", attr.EntryPoint, "#2");
Assert.AreEqual ("libfoo", attr.Value, "#3");
#endif
Assert.AreEqual (CharSet.Unicode, attr.CharSet, "#4");
Assert.AreEqual (false, attr.ExactSpelling, "#5");
Assert.AreEqual (true, attr.PreserveSig, "#6");
@ -205,6 +217,7 @@ namespace MonoTests.System.Reflection
return (int*) 0;
}
#if MONO_FEATURE_THREAD_ABORT
[Test] // bug #81538
public void InvokeThreadAbort ()
{
@ -223,6 +236,7 @@ namespace MonoTests.System.Reflection
{
Thread.CurrentThread.Abort ();
}
#endif
[Test] // bug #76541
public void ToStringByRef ()
@ -281,6 +295,35 @@ namespace MonoTests.System.Reflection
Assert.AreEqual (typeof (GBD_D), typeof (GBD_E).GetMethod ("f").GetBaseDefinition ().DeclaringType);
}
class GenericBase<T,H> {
public virtual void f2 () { }
}
class GenericMid<T, U> : GenericBase<T, Action<U>> {
public virtual T f1 () { return default (T); }
}
class GenericChild<T> : GenericMid<T, int> {
public override T f1 () { return default (T); }
public override void f2 () { }
}
[Test]
public void GetBaseDefinition_OpenConstructedBaseType () // 36305
{
var t = typeof (GenericChild<string>);
var mi1 = t.GetMethod ("f1");
var mi1_base = mi1.GetBaseDefinition ();
Assert.AreEqual (typeof (GenericMid<string, int>), mi1_base.DeclaringType, "#1");
var mi2 = t.GetMethod ("f2");
var mi2_base = mi2.GetBaseDefinition ();
Assert.AreEqual (typeof (GenericBase<string, Action<int>>), mi2_base.DeclaringType, "#2");
}
class TestInheritedMethodA {
private void TestMethod ()
{
@ -744,7 +787,6 @@ namespace MonoTests.System.Reflection
{
}
}
#if NET_4_0
interface IMethodInvoke<out T>
{
T Test ();
@ -768,7 +810,6 @@ namespace MonoTests.System.Reflection
Assert.AreEqual ("MethodInvoke", m0.Invoke (obj, new Object [0]));
Assert.AreEqual ("MethodInvoke", m1.Invoke (obj, new Object [0]));
}
#endif
public int? Bug12856 ()