Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test base #19521

Merged
merged 7 commits into from
May 17, 2017
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/Targets/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
<VSSDKComponentModelHostVersion>12.0.4</VSSDKComponentModelHostVersion>
<VsWebsiteInteropVersion>8.0.0.0-alpha</VsWebsiteInteropVersion>
<xunitVersion>2.2.0-beta4-build3444</xunitVersion>
<xunitassertVersion>2.2.0-beta4-build3444</xunitassertVersion>
<xunitconsolenetcoreVersion>1.0.2-prerelease-00104</xunitconsolenetcoreVersion>
<xunitrunnerconsoleVersion>2.2.0-beta4-build3444</xunitrunnerconsoleVersion>
<xunitrunnervisualstudioVersion>2.2.0-beta4-build1194</xunitrunnervisualstudioVersion>
Expand Down
3 changes: 1 addition & 2 deletions src/Compilers/CSharp/Test/Emit/CSharpCompilerEmitTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,13 @@
<Compile Include="Emit\EditAndContinue\LocalSlotMappingTests.cs" />
<Compile Include="Emit\EmitCustomModifiers.cs" />
<Compile Include="Emit\EmitErrorTests.cs" />
<Compile Include="Emit\EmitMetadata.cs" />
<Compile Include="Emit\EmitMetadataTests.cs" />
<Compile Include="Emit\EmitMetadataTestBase.cs" />
<Compile Include="Attributes\EmitTestStrongNameProvider.cs" />
<Compile Include="Emit\EndToEndTests.cs" />
<Compile Include="Emit\EntryPointTests.cs" />
<Compile Include="Emit\NoPiaEmbedTypes.cs" />
<Compile Include="Emit\OptionalArgumentsTests.cs" />
<Compile Include="Emit\OutputStreams.cs" />
<Compile Include="Emit\ResourceTests.cs" />
<Compile Include="CodeGen\CodeGenScriptTests.cs" />
<Compile Include="PDB\CheckSumTest.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.CodeGen
{
public static class LocalFunctionTestsUtil
{
public static IMethodSymbol FindLocalFunction(this CommonTestBase.CompilationVerifier verifier, string localFunctionName)
public static IMethodSymbol FindLocalFunction(this CompilationVerifier verifier, string localFunctionName)
{
localFunctionName = (char)GeneratedNameKind.LocalFunction + "__" + localFunctionName;
var methods = verifier.TestData.GetMethodsByName();
Expand Down
9 changes: 1 addition & 8 deletions src/Compilers/CSharp/Test/Emit/CodeGen/GotoTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
Expand Down Expand Up @@ -703,14 +704,6 @@ public static IEnumerable Power(int number, int exponent)
CompileAndVerify(text, expectedOutput: expectedOutput);
}

// When ReflectionEmit supports writing exception handler info, this method
// can be removed and CompileAndVerify references above will resolve to
// the overload that emits with both CCI and ReflectionEmit. (Bug #7012)
private CompilationVerifier CompileAndVerify(string source, string expectedOutput = null)
{
return base.CompileAndVerify(source: source, expectedOutput: expectedOutput);
}

[WorkItem(540719, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540719")]
[Fact]
public void LabelBetweenLocalAndInitialize()
Expand Down
23 changes: 0 additions & 23 deletions src/Compilers/CSharp/Test/Emit/Emit/OutputStreams.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Test/Emit/PDB/PDBUsingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2214,7 +2214,7 @@ class C
var emitResult1 = c.Emit(peStream: peStream1, pdbStream: pdbStream);
var emitResult2 = c.Emit(peStream: peStream2);

PdbValidation.VerifyMetadataEqualModuloMvid(peStream1, peStream2);
MetadataValidation.VerifyMetadataEqualModuloMvid(peStream1, peStream2);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ static System.Action<object> F()
Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, "value__").WithArguments("A.value__"));

// PEVerify should not report "Field value__ ... is not marked RTSpecialName".
var verifier = new CompilationVerifier(this, compilation);
var verifier = new CompilationVerifier(compilation);
verifier.EmitAndVerify(
"Error: Field name value__ is reserved for Enums only.",
"Error: Field name value__ is reserved for Enums only.",
Expand Down
9 changes: 3 additions & 6 deletions src/Compilers/CSharp/Test/WinRT/WinRTUtil.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using static Microsoft.CodeAnalysis.Test.Utilities.CommonTestBase;

namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
Expand Down
1 change: 1 addition & 0 deletions src/Compilers/Core/Portable/CodeAnalysis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,7 @@
<InternalsVisibleToTest Include="Roslyn.Test.Utilities.Desktop" />
<InternalsVisibleToTest Include="Roslyn.Test.Utilities.FX45" />
<InternalsVisibleToTest Include="Roslyn.Test.Utilities" />
<InternalsVisibleToTest Include="Roslyn.Test.PdbUtilities" />
<InternalsVisibleToTest Include="Roslyn.Compilers.CompilerServer.UnitTests" />
<InternalsVisibleToMoq Include="DynamicProxyGenAssembly2" />
</ItemGroup>
Expand Down
5 changes: 0 additions & 5 deletions src/Compilers/Test/Utilities/CSharp/BasicCompilationUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ protected override Compilation GetCompilationForEmit(IEnumerable<string> source,
throw new NotImplementedException();
}

internal override IEnumerable<IModuleSymbol> ReferencesToModuleSymbols(IEnumerable<MetadataReference> references, MetadataImportOptions importOptions = MetadataImportOptions.Public)
{
throw new NotImplementedException();
}

internal override string VisualizeRealIL(IModuleSymbol peModule, CodeAnalysis.CodeGen.CompilationTestData.MethodData methodData, IReadOnlyDictionary<int, string> markers)
{
throw new NotImplementedException();
Expand Down
23 changes: 0 additions & 23 deletions src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ protected CSharpCompilation GetCSharpCompilationForEmit(
return (CSharpCompilation)base.GetCompilationForEmit(source, additionalRefs, options, parseOptions);
}

internal new IEnumerable<ModuleSymbol> ReferencesToModuleSymbols(IEnumerable<MetadataReference> references, MetadataImportOptions importOptions = MetadataImportOptions.Public)
{
return base.ReferencesToModuleSymbols(references, importOptions).Cast<ModuleSymbol>();
}

private Action<IModuleSymbol> Translate2(Action<ModuleSymbol> action)
{
if (action != null)
Expand Down Expand Up @@ -219,24 +214,6 @@ public static CSharpCompilation CreateWinRtCompilation(string text, MetadataRefe
TestOptions.ReleaseExe);
}

internal override IEnumerable<IModuleSymbol> ReferencesToModuleSymbols(IEnumerable<MetadataReference> references, MetadataImportOptions importOptions = MetadataImportOptions.Public)
{
var options = TestOptions.ReleaseDll.WithMetadataImportOptions(importOptions);
var tc1 = CSharpCompilation.Create("Dummy", new SyntaxTree[0], references, options);
return references.Select(r =>
{
if (r.Properties.Kind == MetadataImageKind.Assembly)
{
var assemblySymbol = tc1.GetReferencedAssemblySymbol(r);
return (object)assemblySymbol == null ? null : assemblySymbol.Modules[0];
}
else
{
return tc1.GetReferencedModuleSymbol(r);
}
});
}

protected override CompilationOptions CompilationOptionsReleaseDll
{
get { return TestOptions.ReleaseDll; }
Expand Down
14 changes: 0 additions & 14 deletions src/Compilers/Test/Utilities/VisualBasic/BasicTestBase.vb
Original file line number Diff line number Diff line change
Expand Up @@ -414,20 +414,6 @@ End Class
Public MustInherit Class BasicTestBaseBase
Inherits CommonTestBase

Friend Overrides Function ReferencesToModuleSymbols(references As IEnumerable(Of MetadataReference), Optional importOptions As MetadataImportOptions = MetadataImportOptions.Public) As IEnumerable(Of IModuleSymbol)
Dim options = DirectCast(CompilationOptionsReleaseDll, VisualBasicCompilationOptions).WithMetadataImportOptions(importOptions)
Dim tc1 = VisualBasicCompilation.Create("Dummy", references:=references, options:=options)
Return references.Select(
Function(r)
If r.Properties.Kind = MetadataImageKind.Assembly Then
Dim assemblySymbol = tc1.GetReferencedAssemblySymbol(r)
Return If(assemblySymbol Is Nothing, Nothing, assemblySymbol.Modules(0))
Else
Return tc1.GetReferencedModuleSymbol(r)
End If
End Function)
End Function

Protected Overrides ReadOnly Property CompilationOptionsReleaseDll As CompilationOptions
Get
Return TestOptions.ReleaseDll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Imports System.IO
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Roslyn.Test.Utilities

Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.PDB
Public Class PDBNamespaceScopes
Expand Down Expand Up @@ -383,7 +384,7 @@ End Class
Dim emitResult1 = c.Emit(peStream:=peStream1, pdbStream:=pdbStream)
Dim emitResult2 = c.Emit(peStream:=peStream2)

PdbValidation.VerifyMetadataEqualModuloMvid(peStream1, peStream2)
MetadataValidation.VerifyMetadataEqualModuloMvid(peStream1, peStream2)
End Sub

<Fact>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Test.Utilities

Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.PDB

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ End Module
compilation.AssertNoErrors()

' PEVerify should not report "Field value__ ... is not marked RTSpecialName".
Dim verifier = New CompilationVerifier(Me, compilation)
Dim verifier = New CompilationVerifier(compilation)
verifier.EmitAndVerify(
"Error: Field name value__ is reserved for Enums only.")
End Sub
Expand Down
4 changes: 0 additions & 4 deletions src/EditorFeatures/Test/EditorServicesTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@
<Project>{eba4dfa1-6ded-418f-a485-a3b608978906}</Project>
<Name>InteractiveHost</Name>
</ProjectReference>
<ProjectReference Include="..\..\Test\PdbUtilities\PdbUtilities.csproj">
<Project>{afde6bea-5038-4a4a-a88e-dbd2e4088eed}</Project>
<Name>PdbUtilities</Name>
</ProjectReference>
<ProjectReference Include="..\..\Workspaces\Remote\Core\RemoteWorkspaces.csproj">
<Project>{f822f72a-cc87-4e31-b57d-853f65cbebf3}</Project>
<Name>RemoteWorkspaces</Name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
using Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation;
using Roslyn.Test.Utilities;
using Xunit;
using PDB::Roslyn.Test.MetadataUtilities;
using PDB::Roslyn.Test.PdbUtilities;

namespace Microsoft.CodeAnalysis.ExpressionEvaluator.UnitTests
Expand Down
58 changes: 0 additions & 58 deletions src/Test/PdbUtilities/Metadata/MethodILExtensions.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,23 @@
using System.Reflection.Metadata;
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Collections;
using Microsoft.CodeAnalysis.Debugging;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.DiaSymReader;
using Roslyn.Test.PdbUtilities;

namespace Roslyn.Test.Utilities
{
internal static class PdbTestUtilities
public static class PdbTestUtilities
{
public static ISymUnmanagedReader3 CreateSymReader(this CompilationVerifier verifier)
{
var pdbStream = new ImmutableMemoryStream(verifier.EmittedAssemblyPdb);
return SymReaderFactory.CreateReader(pdbStream, metadataReaderOpt: null, metadataMemoryOwnerOpt: null);
}

public unsafe static EditAndContinueMethodDebugInformation GetEncMethodDebugInfo(this ISymUnmanagedReader3 symReader, MethodDefinitionHandle handle)
{
const int S_OK = 0;
Expand Down
Loading