Imported Upstream version 4.8.0.309

Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-11-10 13:04:39 +00:00
parent ee1447783b
commit 94b2861243
4912 changed files with 390737 additions and 49310 deletions

View File

@@ -1152,10 +1152,8 @@ public class AssemblyNameTest {
Assert.IsNull (an.GetPublicKey (), "GetPublicKey");
Assert.IsNull (an.GetPublicKeyToken (), "GetPublicKeyToken");
Assert.AreEqual ("TestAssembly", an.ToString (), "ToString");
#if NET_4_5
Assert.IsNull (an.CultureName, "CultureName");
Assert.AreEqual (AssemblyContentType.Default, an.ContentType, "ContentType");
#endif
}
[Test] // ctor (String)

File diff suppressed because it is too large Load Diff

View File

@@ -26,7 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.Reflection;
@@ -54,4 +53,3 @@ namespace MonoTests.System.Reflection
}
}
#endif

View File

@@ -24,13 +24,26 @@ namespace MonoTests.System.Reflection
[TestFixture]
public class ModuleTest
{
static string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.Reflection.ModuleTest");
static string BaseTempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.Reflection.ModuleTest");
static string TempFolder;
[TestFixtureSetUp]
public void FixtureSetUp ()
{
try {
// Try to cleanup from any previous NUnit run.
Directory.Delete (BaseTempFolder, true);
} catch (Exception) {
}
}
[SetUp]
public void SetUp ()
{
while (Directory.Exists (TempFolder))
TempFolder = Path.Combine (TempFolder, "2");
int i = 0;
do {
TempFolder = Path.Combine (BaseTempFolder, (++i).ToString());
} while (Directory.Exists (TempFolder));
Directory.CreateDirectory (TempFolder);
}
@@ -38,8 +51,8 @@ public class ModuleTest
public void TearDown ()
{
try {
// This throws an exception under MS.NET, since the directory contains loaded
// assemblies.
// This throws an exception under MS.NET and Mono on Windows,
// since the directory contains loaded assemblies.
Directory.Delete (TempFolder, true);
} catch (Exception) {
}

View File

@@ -71,7 +71,7 @@ namespace MonoTests.System.Reflection.Emit
#if !MOBILE
Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", inst.FullName, "#3");
Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
#elif NET_2_1 || MOBILE
#elif MOBILE || MOBILE
Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]", inst.FullName, "#3");
Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
Assert.AreEqual ("foo.type[System.Double,System.String]", inst.ToString (), "#5");

View File

@@ -73,7 +73,7 @@ namespace MonoTests.System.Reflection
}
}
#if !NET_2_1
#if !MOBILE
public enum ParamEnum {
None = 0,
Foo = 1,
@@ -97,14 +97,12 @@ namespace MonoTests.System.Reflection
Assert.AreEqual (ParamEnum.Foo, info [5].DefaultValue, "#2");
}
#if NET_4_5
[Test]
public void HasDefaultValueEnum () {
ParameterInfo[] info = typeof (ParameterInfoTest).GetMethod ("paramMethod").GetParameters ();
Assert.IsTrue (info [5].HasDefaultValue);
}
#endif
public static void Sample2 ([DecimalConstantAttribute(2,2,2,2,2)] decimal a, [DateTimeConstantAttribute(123456)] DateTime b) {}
@@ -125,7 +123,6 @@ namespace MonoTests.System.Reflection
Assert.AreEqual (pi [1].DefaultValue.GetType (), typeof (Missing), "#2");
}
#if NET_4_5
[Test]
public void TestHasDefaultValues ()
{
@@ -135,7 +132,6 @@ namespace MonoTests.System.Reflection
Assert.IsFalse (pi [1].HasDefaultValue, "#2");
Assert.IsTrue (pi [2].HasDefaultValue, "#3");
}
#endif
public void Sample (int a, [Optional] int b, object c = null)
{
@@ -252,13 +248,11 @@ namespace MonoTests.System.Reflection
Assert.AreEqual (decimal.MaxValue, info [0].DefaultValue);
}
#if NET_4_5
[Test]
public void HasDefaultValueDecimal () {
var info = typeof (ParameterInfoTest).GetMethod ("TestC").GetParameters ();
Assert.IsTrue (info [0].HasDefaultValue);
}
#endif
class TestParamAttribute : Attribute
{
@@ -344,13 +338,11 @@ namespace MonoTests.System.Reflection
Assert.AreEqual (0, p.GetCustomAttributes (typeof (FlagsAttribute), false).Length, "#3");
Assert.AreEqual (0, p.GetOptionalCustomModifiers ().Length, "#4");
Assert.AreEqual (0, p.GetRequiredCustomModifiers ().Length, "#5");
#if NET_4_5
try {
var ign = p.HasDefaultValue;
Assert.Fail ("#6");
} catch (NotImplementedException) {
}
#endif
Assert.IsFalse (p.IsIn, "#7");
#if FEATURE_USE_LCID
Assert.IsFalse (p.IsLcid, "#8");
@@ -358,13 +350,11 @@ namespace MonoTests.System.Reflection
Assert.IsFalse (p.IsOptional, "#9");
Assert.IsFalse (p.IsOut, "#10");
Assert.IsFalse (p.IsRetval, "#10");
#if NET_4_5
try {
var ign = p.CustomAttributes;
Assert.Fail ("#11");
} catch (NotImplementedException) {
}
#endif
try {
p.GetCustomAttributesData ();
Assert.Fail ("#12");
@@ -446,9 +436,7 @@ namespace MonoTests.System.Reflection
Assert.IsFalse (p2.IsIn, "#1");
p2.MyAttrsImpl = ParameterAttributes.In;
Assert.IsTrue (p2.IsIn, "#2");
#if NET_4_5
Assert.AreEqual (p2.myList, p2.CustomAttributes, "#3");
#endif
}
}
}

View File

@@ -391,7 +391,12 @@ namespace MonoTests.System.Reflection
var p = t.GetProperty ("Prop");
Assert.AreEqual ("test", p.GetConstantValue (), "#1");
File.Delete (Path.Combine (Path.GetTempPath (), an));
try {
// This throws an exception under MS.NET and Mono on Windows,
// open files cannot be deleted. That's fine.
File.Delete (Path.Combine (Path.GetTempPath (), an));
} catch (Exception) {
}
var pa = typeof (TestE).GetProperty ("PropE");
try {