Imported Upstream version 3.10.0

Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
Jo Shields
2014-10-04 11:27:48 +01:00
parent fe777c5c82
commit 8b9b85e7f5
970 changed files with 20242 additions and 31308 deletions

View File

@ -13,7 +13,7 @@ using System;
using System.Configuration.Assemblies;
using System.IO;
using System.Reflection;
#if !TARGET_JVM && !MOBILE
#if !MOBILE
using System.Reflection.Emit;
#endif
using System.Runtime.Serialization;
@ -31,9 +31,7 @@ public class AssemblyNameTest {
private string tempDir = Path.Combine (Path.GetTempPath (), "MonoTests.System.Reflection.AssemblyNameTest");
#if !TARGET_JVM // Thread.GetDomain is not supported for TARGET_JVM.
private AppDomain domain;
#endif // TARGET_JVM
// created with "sn -o test.snk test.txt"
static byte[] keyPair = {
@ -154,9 +152,7 @@ public class AssemblyNameTest {
Directory.CreateDirectory (tempDir);
#if !TARGET_JVM // Thread.GetDomain is not supported for TARGET_JVM.
domain = Thread.GetDomain ();
#endif // TARGET_JVM
}
[TearDown]
@ -761,7 +757,7 @@ public class AssemblyNameTest {
return assemblyName;
}
#if !TARGET_JVM && !MOBILE // Reflection.Emit is not supported for TARGET_JVM.
#if !MOBILE
private Assembly GenerateAssembly (AssemblyName name)
{
AssemblyBuilder ab = domain.DefineDynamicAssembly (
@ -892,7 +888,7 @@ public class AssemblyNameTest {
ab = GenerateDynamicAssembly (name);
Assert.AreEqual ("1.2.0.0", ab.GetName ().Version.ToString (), "1.2.0.0 dynamic");
}
#endif // TARGET_JVM
#endif
[Test]
public void HashAlgorithm ()
@ -983,7 +979,6 @@ public class AssemblyNameTest {
Assert.AreEqual (an.GetPublicKeyToken (), dsAssemblyName.GetPublicKeyToken (), "PublicToken");
}
#if !TARGET_JVM // Assemblyname.GetObjectData not implemented yet for TARGET_JVM
[Test]
public void GetObjectData_Info_Null ()
{
@ -999,7 +994,6 @@ public class AssemblyNameTest {
Assert.AreEqual ("info", ex.ParamName, "#6");
}
}
#endif // TARGET_JVM
[Test]
public void Clone_Corlib ()
@ -1166,7 +1160,6 @@ public class AssemblyNameTest {
}
[Test] // ctor (String)
[Category("TargetJvmNotWorking")] // Not yet supported for TARGET_JVM.
public void Constructor1_Full ()
{
const string assemblyName = "TestAssembly";
@ -1768,7 +1761,6 @@ public class AssemblyNameTest {
}
[Test] // ctor (String)
[Category("TargetJvmNotWorking")] // Not yet supported for TARGET_JVM.
public void Constructor1_Version ()
{
const string assemblyName = "TestAssembly";

View File

@ -35,7 +35,7 @@ using System.Configuration.Assemblies;
using System.Globalization;
using System.IO;
using System.Reflection;
#if !TARGET_JVM && !MONOTOUCH
#if !MONOTOUCH
using System.Reflection.Emit;
#endif
using System.Threading;
@ -141,18 +141,18 @@ namespace MonoTests.System.Reflection
string fname = AppDomain.CurrentDomain.FriendlyName;
if (fname.EndsWith (".dll")) { // nunit-console
Assert.IsNull (Assembly.GetEntryAssembly (), "GetEntryAssembly");
#if NET_2_0 && !TARGET_JVM // IsDefaultAppDomain not supported for TARGET_JVM
#if NET_2_0
Assert.IsFalse (AppDomain.CurrentDomain.IsDefaultAppDomain (), "!default appdomain");
#endif
} else { // gnunit
Assert.IsNotNull (Assembly.GetEntryAssembly (), "GetEntryAssembly");
#if NET_2_0 && !TARGET_JVM // IsDefaultAppDomain not supported for TARGET_JVM
#if NET_2_0
Assert.IsTrue (AppDomain.CurrentDomain.IsDefaultAppDomain (), "!default appdomain");
#endif
}
}
#if !TARGET_JVM && !MONOTOUCH // Reflection.Emit is not supported.
#if !MONOTOUCH // Reflection.Emit is not supported.
[Test]
public void GetModules_MissingFile ()
{
@ -177,7 +177,6 @@ namespace MonoTests.System.Reflection
}
#endif
#if !TARGET_JVM // ManifestModule not supported under TARGET_JVM.
[Category ("NotWorking")]
[Test]
public void Corlib ()
@ -224,7 +223,6 @@ namespace MonoTests.System.Reflection
Assert.IsNotNull (corlib_test.ManifestModule, "ManifestModule");
Assert.IsFalse (corlib_test.ReflectionOnly, "ReflectionOnly");
}
#endif
[Test]
public void GetAssembly ()
@ -234,7 +232,6 @@ namespace MonoTests.System.Reflection
}
[Test]
[Category("TargetJvmNotWorking")] // Not yet supported for TARGET_JVM
public void GetFile_Null ()
{
try {
@ -249,7 +246,6 @@ namespace MonoTests.System.Reflection
}
[Test]
[Category("TargetJvmNotWorking")] // Not yet supported for TARGET_JVM
public void GetFile_Empty ()
{
try {
@ -265,7 +261,6 @@ namespace MonoTests.System.Reflection
}
[Test]
[Category("TargetJvmNotWorking")] // Not yet supported for TARGET_JVM
public void GetFiles_False ()
{
Assembly corlib = typeof (int).Assembly;
@ -278,7 +273,6 @@ namespace MonoTests.System.Reflection
}
[Test]
[Category("TargetJvmNotWorking")] // Not yet supported for TARGET_JVM
public void GetFiles_True ()
{
Assembly corlib = typeof (int).Assembly;
@ -427,7 +421,6 @@ namespace MonoTests.System.Reflection
Assert.Fail ("Was not able to load any corlib test");
}
#if !TARGET_JVM // GetObjectData currently not implemented for Assembly.
[Test]
public void GetObjectData_Info_Null ()
{
@ -444,7 +437,6 @@ namespace MonoTests.System.Reflection
Assert.AreEqual ("info", ex.ParamName, "#6");
}
}
#endif // TARGET_JVM
[Test]
public void GetReferencedAssemblies ()
@ -466,7 +458,7 @@ namespace MonoTests.System.Reflection
}
}
#if !TARGET_JVM && !MONOTOUCH // Reflection.Emit is not supported.
#if !MONOTOUCH // Reflection.Emit is not supported.
[Test]
public void Location_Empty() {
string assemblyFileName = Path.Combine (
@ -1085,7 +1077,7 @@ namespace MonoTests.System.Reflection
Directory.Delete (outdir, true);
}
#endif // TARGET_JVM
#endif
[Test]
public void ManifestModule ()

View File

@ -31,9 +31,9 @@
using System;
using System.Threading;
using System.Reflection;
#if !TARGET_JVM && !MONOTOUCH
#if !MONOTOUCH
using System.Reflection.Emit;
#endif // TARGET_JVM
#endif
using System.Runtime.InteropServices;
using NUnit.Framework;
@ -397,7 +397,6 @@ namespace MonoTests.System.Reflection
typeof (Foo).GetField ("static_field").GetValue (typeof (int));
}
#if !TARGET_JVM // ReflectionOnlyLoad not supported for TARGET_JVM
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void GetValueOnRefOnlyAssembly ()
@ -417,7 +416,6 @@ namespace MonoTests.System.Reflection
FieldInfo f = t.GetField ("RefOnlyField", BindingFlags.Static | BindingFlags.NonPublic);
f.SetValue (null, 8);
}
#endif // TARGET_JVM
const int literal = 42;
@ -453,7 +451,6 @@ namespace MonoTests.System.Reflection
Assert.AreEqual (null, fi2.GetValue (t));
}
#if !TARGET_JVM // TypeBuilder not supported for TARGET_JVM
[Test]
public void NonPublicTests ()
{
@ -468,7 +465,6 @@ namespace MonoTests.System.Reflection
fi = t.GetField ("protectedField", BindingFlags.NonPublic | BindingFlags.Instance);
Assert.IsNotNull (fi);
}
#endif // TARGET_JVM
[Test]
public void GetRawDefaultValue ()

View File

@ -51,10 +51,8 @@ namespace MonoTests.System.Reflection
[TestFixture]
public class MethodInfoTest
{
#if !TARGET_JVM
[DllImport ("libfoo", EntryPoint="foo", CharSet=CharSet.Unicode, ExactSpelling=false, PreserveSig=true, SetLastError=true, BestFitMapping=true, ThrowOnUnmappableChar=true)]
public static extern void dllImportMethod ();
#endif
[MethodImplAttribute(MethodImplOptions.PreserveSig)]
public void preserveSigMethod ()
{
@ -128,7 +126,6 @@ namespace MonoTests.System.Reflection
}
[Test]
[Category ("TargetJvmNotWorking")]
public void ReturnTypePseudoCustomAttributes ()
{
MethodInfo mi = typeof (MethodInfoTest).GetMethod ("ReturnTypeMarshalAs");
@ -317,7 +314,6 @@ namespace MonoTests.System.Reflection
}
#if NET_2_0
#if !TARGET_JVM // MethodBody is not supported for TARGET_JVM
[Test]
public void GetMethodBody_Abstract ()
{
@ -382,7 +378,6 @@ namespace MonoTests.System.Reflection
else
Assert.AreEqual (false, locals [1].IsPinned, "#6");
}
#endif // TARGET_JVM
public int return_parameter_test ()
{
@ -413,7 +408,6 @@ namespace MonoTests.System.Reflection
//Assert.IsTrue (pi.IsRetval, "#3");
}
#if !TARGET_JVM // ReflectionOnly is not supported yet on TARGET_JVM
[Test]
public void InvokeOnRefOnlyAssembly ()
{
@ -431,7 +425,6 @@ namespace MonoTests.System.Reflection
Assert.IsNotNull (ex.Message, "#4");
}
}
#endif // TARGET_JVM
[Test]
[ExpectedException (typeof (TargetInvocationException))]

View File

@ -83,13 +83,11 @@ namespace MonoTests.System.Reflection
{
}
#if !TARGET_JVM // No support for extern methods in TARGET_JVM
[DllImport ("foo")]
public extern static void marshalAsMethod (
[MarshalAs(UnmanagedType.Bool)]int p0,
[MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr)] string [] p1,
[MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof (Marshal1), MarshalCookie = "5")] object p2);
#endif
[Test]
public void DefaultValueEnum () {
ParameterInfo[] info = typeof (ParameterInfoTest).GetMethod ("paramMethod").GetParameters ();
@ -151,7 +149,6 @@ namespace MonoTests.System.Reflection
Assert.AreEqual (1, info[3].GetCustomAttributes (typeof (OptionalAttribute), true).Length, "#A4");
Assert.AreEqual (2, info[4].GetCustomAttributes (true).Length, "#A5");
#if !TARGET_JVM // No support for extern methods in TARGET_JVM
ParameterInfo[] pi = typeof (ParameterInfoTest).GetMethod ("marshalAsMethod").GetParameters ();
MarshalAsAttribute attr;
@ -166,7 +163,6 @@ namespace MonoTests.System.Reflection
Assert.AreEqual (UnmanagedType.CustomMarshaler, attr.Value, "#D1");
Assert.AreEqual ("5", attr.MarshalCookie, "#D2");
Assert.AreEqual (typeof (Marshal1), Type.GetType (attr.MarshalType), "#D3");
#endif
}
[Test] // bug #342536

View File

@ -28,9 +28,9 @@
using System;
using System.Threading;
using System.Reflection;
#if !TARGET_JVM && !MONOTOUCH
#if !MONOTOUCH
using System.Reflection.Emit;
#endif // TARGET_JVM
#endif
using NUnit.Framework;