You've already forked linux-packaging-mono
Imported Upstream version 5.10.0.69
Former-commit-id: fc39669a0b707dd3c063977486506b6793da2890
This commit is contained in:
parent
d8f8abd549
commit
e2950ec768
@@ -1,18 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyName>System.Private.Reflection.Metadata</AssemblyName>
|
||||
<AssemblyVersion>4.0.0.0</AssemblyVersion>
|
||||
<OutputType>Library</OutputType>
|
||||
<ProjectGuid>{45A617DF-FEC7-59C8-FD0D-BD27938DC940}</ProjectGuid>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<IsDotNetFrameworkProductAssembly>true</IsDotNetFrameworkProductAssembly>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Default configurations to help VS understand the options -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
|
||||
|
||||
<ItemGroup Condition="'$(IsProjectNLibrary)' != 'true'">
|
||||
<ProjectReference Include="..\..\System.Private.CoreLib\src\System.Private.CoreLib.csproj" />
|
||||
</ItemGroup>
|
||||
@@ -35,8 +30,8 @@
|
||||
<Compile Include="$(MetadataCommonPath)\NativeFormatReaderGen.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\Common\src\System\Runtime\CompilerServices\__BlockReflectionAttribute.cs" Condition="'$(IsProjectNLibrary)' != 'true'">
|
||||
<Link>System\Runtime\CompilerServices\__BlockReflectionAttribute.cs</Link>
|
||||
<Compile Include="..\..\Common\src\System\Runtime\CompilerServices\__BlockAllReflectionAttribute.cs" Condition="'$(IsProjectNLibrary)' != 'true'">
|
||||
<Link>System\Runtime\CompilerServices\__BlockAllReflectionAttribute.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
73
external/corert/src/System.Private.Reflection.Metadata/tests/CollectionExtensions.cs
vendored
Normal file
73
external/corert/src/System.Private.Reflection.Metadata/tests/CollectionExtensions.cs
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Internal.Metadata.NativeFormat;
|
||||
|
||||
using Debug = System.Diagnostics.Debug;
|
||||
|
||||
namespace System.Private.Reflection.Metadata.Tests
|
||||
{
|
||||
static class CollectionExtensions
|
||||
{
|
||||
public static ScopeDefinitionHandle Single(this ScopeDefinitionHandleCollection collection)
|
||||
{
|
||||
Debug.Assert(collection.Count == 1);
|
||||
var enumerator = collection.GetEnumerator();
|
||||
bool hasNext = enumerator.MoveNext();
|
||||
Debug.Assert(hasNext);
|
||||
var result = enumerator.Current;
|
||||
Debug.Assert(!enumerator.MoveNext());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static TypeDefinitionHandle Single(this TypeDefinitionHandleCollection collection)
|
||||
{
|
||||
Debug.Assert(collection.Count == 1);
|
||||
var enumerator = collection.GetEnumerator();
|
||||
bool hasNext = enumerator.MoveNext();
|
||||
Debug.Assert(hasNext);
|
||||
var result = enumerator.Current;
|
||||
Debug.Assert(!enumerator.MoveNext());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static NamespaceDefinitionHandle Single(this NamespaceDefinitionHandleCollection collection)
|
||||
{
|
||||
Debug.Assert(collection.Count == 1);
|
||||
var enumerator = collection.GetEnumerator();
|
||||
bool hasNext = enumerator.MoveNext();
|
||||
Debug.Assert(hasNext);
|
||||
var result = enumerator.Current;
|
||||
Debug.Assert(!enumerator.MoveNext());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static MethodHandle Single(this MethodHandleCollection collection)
|
||||
{
|
||||
Debug.Assert(collection.Count == 1);
|
||||
var enumerator = collection.GetEnumerator();
|
||||
bool hasNext = enumerator.MoveNext();
|
||||
Debug.Assert(hasNext);
|
||||
var result = enumerator.Current;
|
||||
Debug.Assert(!enumerator.MoveNext());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static IEnumerable<NamespaceDefinitionHandle> AsEnumerable(this NamespaceDefinitionHandleCollection collection)
|
||||
{
|
||||
foreach (var element in collection)
|
||||
yield return element;
|
||||
}
|
||||
|
||||
public static IEnumerable<TypeDefinitionHandle> AsEnumerable(this TypeDefinitionHandleCollection collection)
|
||||
{
|
||||
foreach (var element in collection)
|
||||
yield return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,14 +154,14 @@ namespace System.Private.Reflection.Metadata.Tests
|
||||
|
||||
// Validate the root namespace and <Module> type
|
||||
Reader.NamespaceDefinition rootNamespace = systemRuntimeScope.RootNamespaceDefinition.GetNamespaceDefinition(rd);
|
||||
Assert.Equal(1, rootNamespace.TypeDefinitions.Count());
|
||||
Assert.Equal(1, rootNamespace.TypeDefinitions.Count);
|
||||
Reader.TypeDefinition moduleType = rootNamespace.TypeDefinitions.Single().GetTypeDefinition(rd);
|
||||
Assert.Equal("<Module>", moduleType.Name.GetConstantStringValue(rd).Value);
|
||||
Assert.Equal(1, rootNamespace.NamespaceDefinitions.Count());
|
||||
Assert.Equal(1, rootNamespace.NamespaceDefinitions.Count);
|
||||
|
||||
// Validate the System namespace
|
||||
Reader.NamespaceDefinition systemNamespace = rootNamespace.NamespaceDefinitions.Single().GetNamespaceDefinition(rd);
|
||||
Assert.Equal(4, systemNamespace.TypeDefinitions.Count());
|
||||
Assert.Equal(4, systemNamespace.TypeDefinitions.Count);
|
||||
foreach (var typeHandle in systemNamespace.TypeDefinitions)
|
||||
{
|
||||
Reader.TypeDefinition type = typeHandle.GetTypeDefinition(rd);
|
||||
@@ -177,19 +177,19 @@ namespace System.Private.Reflection.Metadata.Tests
|
||||
{
|
||||
case "Object":
|
||||
Assert.Null(baseTypeName);
|
||||
Assert.Equal(1, type.Methods.Count());
|
||||
Assert.Equal(1, type.Methods.Count);
|
||||
break;
|
||||
case "Void":
|
||||
Assert.Equal("ValueType", baseTypeName);
|
||||
Assert.Equal(0, type.Methods.Count());
|
||||
Assert.Equal(0, type.Methods.Count);
|
||||
break;
|
||||
case "String":
|
||||
Assert.Equal("Object", baseTypeName);
|
||||
Assert.Equal(1, type.Methods.Count());
|
||||
Assert.Equal(1, type.Methods.Count);
|
||||
break;
|
||||
case "ValueType":
|
||||
Assert.Equal("Object", baseTypeName);
|
||||
Assert.Equal(0, type.Methods.Count());
|
||||
Assert.Equal(0, type.Methods.Count);
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
@@ -214,7 +214,7 @@ namespace System.Private.Reflection.Metadata.Tests
|
||||
Reader.ScopeDefinition systemRuntimeScope = scopeHandle.GetScopeDefinition(rd);
|
||||
Reader.NamespaceDefinition rootNamespace = systemRuntimeScope.RootNamespaceDefinition.GetNamespaceDefinition(rd);
|
||||
Reader.NamespaceDefinition systemNamespace =
|
||||
rootNamespace.NamespaceDefinitions.Single(
|
||||
rootNamespace.NamespaceDefinitions.AsEnumerable().Single(
|
||||
ns => ns.GetNamespaceDefinition(rd).Name.StringEquals("System", rd)
|
||||
).GetNamespaceDefinition(rd);
|
||||
|
||||
@@ -222,10 +222,10 @@ namespace System.Private.Reflection.Metadata.Tests
|
||||
// Since both System.Object and System.String define a default constructor and the
|
||||
// records are structurally equivalent, there should only be one metadata record
|
||||
// representing a default .ctor in the blob.
|
||||
Reader.TypeDefinition objectType = systemNamespace.TypeDefinitions.Single(
|
||||
Reader.TypeDefinition objectType = systemNamespace.TypeDefinitions.AsEnumerable().Single(
|
||||
t => t.GetTypeDefinition(rd).Name.StringEquals("Object", rd)
|
||||
).GetTypeDefinition(rd);
|
||||
Reader.TypeDefinition stringType = systemNamespace.TypeDefinitions.Single(
|
||||
Reader.TypeDefinition stringType = systemNamespace.TypeDefinitions.AsEnumerable().Single(
|
||||
t => t.GetTypeDefinition(rd).Name.StringEquals("String", rd)
|
||||
).GetTypeDefinition(rd);
|
||||
|
||||
|
||||
@@ -2,20 +2,11 @@
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{3A6D978E-156A-4BFF-B394-7F6F6BB22AE1}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AssemblyName>System.Private.Reflection.Metadata.Tests</AssemblyName>
|
||||
<RootNamespace>System.Private.Reflection.Metadata.Tests</RootNamespace>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<NugetTargetMoniker>.NETStandard,Version=v1.3</NugetTargetMoniker>
|
||||
<TestTFM>netcoreapp1.1</TestTFM>
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the configurations -->
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<TargetFramework>netstandard1.3</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<NativeFormatCommonPath>..\..\Common\src\Internal\NativeFormat</NativeFormatCommonPath>
|
||||
@@ -34,10 +25,13 @@
|
||||
<Compile Include="$(MetadataCommonPath)\NativeMetadataReader.cs" />
|
||||
<Compile Include="$(MetadataCommonPath)\NativeFormatReaderGen.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.DotNet.BuildTools.TestSuite">
|
||||
<Version>$(XunitNetcoreExtensionsVersion)</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\ILCompiler.MetadataWriter\src\ILCompiler.MetadataWriter.csproj">
|
||||
<Project>{D66338D4-F9E4-4051-B302-232C6BFB6EF6}</Project>
|
||||
<Name>ILCompiler.MetadataWriter</Name>
|
||||
<Aliases>writer</Aliases>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
@@ -51,11 +45,9 @@
|
||||
<Compile Include="..\..\Common\src\TypeSystem\Common\TypeHashingAlgorithms.cs">
|
||||
<Link>TypeHashingAlgorithms.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="CollectionExtensions.cs" />
|
||||
<Compile Include="HashCodeTests.cs" />
|
||||
<Compile Include="RoundTripTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.6.1",
|
||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||
"Microsoft.DotNet.BuildTools.TestSuite": "1.0.0-prerelease-00807-03",
|
||||
"test-runtime": {
|
||||
"target": "project",
|
||||
"exclude": "compile"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard1.3": { }
|
||||
},
|
||||
"supports": {
|
||||
"coreFx.Test.netcoreapp1.1": { }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user