Imported Upstream version 5.10.0.130

Former-commit-id: e3de1cfbe4cdec293baff4e9f7bf6aac737f2ac4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-02-21 08:38:00 +00:00
parent dfe346d80a
commit 65dc56118c
35 changed files with 52 additions and 35 deletions

View File

@ -28,6 +28,7 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Linq;
@ -36,10 +37,22 @@ namespace MonoTests.System.Runtime.CompilerServices
[TestFixture]
public class RuntimeFeatureTest
{
readonly (string, bool)[] ExpectedFeatures = new [] {
("PortablePdb", true)
readonly Dictionary<string, bool> ExpectedFeatures = new Dictionary<string, bool> {
{"PortablePdb", true}
};
[Test]
public void PortablePdbSupported ()
{
Assert.IsTrue (RuntimeFeature.IsSupported (RuntimeFeature.PortablePdb));
}
[Test]
public void NonExistingFeatureNotSupported ()
{
Assert.IsFalse (RuntimeFeature.IsSupported ("foo"));
}
[Test]
public void NoNewFeaturesAdded ()
{
@ -47,11 +60,15 @@ namespace MonoTests.System.Runtime.CompilerServices
var features = from field in t.GetFields()
where field.FieldType == typeof (string)
let value = field.GetValue (null)
select (
select new KeyValuePair<string, bool> (
field.Name,
RuntimeFeature.IsSupported ((string)value)
);
Assert.AreEqual (ExpectedFeatures, features.ToArray ());
if (features.Count() == 0)
Assert.Inconclusive ("No features found, this can happen when running the linker.");
CollectionAssert.AreEquivalent (ExpectedFeatures, features.ToDictionary (k => k.Key, v => v.Value));
}
}
}