提交 723eb112 编写于 作者: T Tomáš Matoušek

Merge pull request #5184 from tmat/ClrOnlyFact

Move ClrOnlyFact to TestUtilities.Shared
......@@ -5436,7 +5436,7 @@ public static void Main()
}
[WorkItem(544926, "DevDiv")]
[ConditionalFact(typeof(ClrOnlyFact))]
[ClrOnlyFact]
public void ResponseFilesWithNoconfig_03()
{
string source = Temp.CreateFile("a.cs").WriteAllText(@"
......
......@@ -8,69 +8,6 @@
namespace Roslyn.Test.Utilities
{
public enum ClrOnlyReason
{
Unknown,
// The Mono version of ilasm doesn't have all of the features we need to run
// our tests. In particular it doesn't appear to support the full range of
// modopt operators that our tests invoke.
Ilasm,
// Mono lists certain methods in a different order than the CLR. For example
// Equals, GetHashCode, ToString, etc ... which breaks our tests which hard
// code the order.
MemberOrder,
// Can't emit a PDB.
Pdb,
// The documentation comment compiler has a dependency on a resource in the
// System.Xml assembly. This is a non-portable / implementation detail
// that Mono doesn't mirror. We need to make this test more robust so it can
// run on all runtimes.
//
// See DocumentationCommentCompiler.GetDescription
DocumentationComment,
// Can't sign.
Signing,
}
public class ClrOnlyFact : FactAttribute
{
public readonly ClrOnlyReason Reason;
public ClrOnlyFact(ClrOnlyReason reason = ClrOnlyReason.Unknown)
{
Reason = reason;
if (MonoHelpers.IsRunningOnMono())
{
Skip = GetSkipReason(Reason);
}
}
private static string GetSkipReason(ClrOnlyReason reason)
{
switch (reason)
{
case ClrOnlyReason.Ilasm:
return "Mono ilasm doesn't support all of the features we need";
case ClrOnlyReason.MemberOrder:
return "Mono returns certain symbols in different order than we are expecting";
case ClrOnlyReason.Pdb:
return "Can't emit a PDB in this scenario";
case ClrOnlyReason.Signing:
return "Can't sign assemblies in this scenario";
case ClrOnlyReason.DocumentationComment:
return "Documentation comment compiler can't run this test on Mono";
default:
return "Test supported only on CLR";
}
}
}
public class WindowsOnly : ExecutionCondition
{
public override bool ShouldSkip { get { return Path.DirectorySeparatorChar != '\\'; } }
......
// 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.Test.Utilities;
using Xunit;
namespace Roslyn.Test.Utilities
{
public enum ClrOnlyReason
{
Unknown,
// The Mono version of ilasm doesn't have all of the features we need to run
// our tests. In particular it doesn't appear to support the full range of
// modopt operators that our tests invoke.
Ilasm,
// Mono lists certain methods in a different order than the CLR. For example
// Equals, GetHashCode, ToString, etc ... which breaks our tests which hard
// code the order.
MemberOrder,
// Can't emit a PDB.
Pdb,
// The documentation comment compiler has a dependency on a resource in the
// System.Xml assembly. This is a non-portable / implementation detail
// that Mono doesn't mirror. We need to make this test more robust so it can
// run on all runtimes.
//
// See DocumentationCommentCompiler.GetDescription
DocumentationComment,
// Can't sign.
Signing,
}
public sealed class ClrOnlyFactAttribute : FactAttribute
{
public readonly ClrOnlyReason Reason;
public ClrOnlyFactAttribute(ClrOnlyReason reason = ClrOnlyReason.Unknown)
{
Reason = reason;
if (MonoHelpers.IsRunningOnMono())
{
Skip = GetSkipReason(Reason);
}
}
private static string GetSkipReason(ClrOnlyReason reason)
{
switch (reason)
{
case ClrOnlyReason.Ilasm:
return "Mono ilasm doesn't support all of the features we need";
case ClrOnlyReason.MemberOrder:
return "Mono returns certain symbols in different order than we are expecting";
case ClrOnlyReason.Pdb:
return "Can't emit a PDB in this scenario";
case ClrOnlyReason.Signing:
return "Can't sign assemblies in this scenario";
case ClrOnlyReason.DocumentationComment:
return "Documentation comment compiler can't run this test on Mono";
default:
return "Test supported only on CLR";
}
}
}
}
......@@ -9,6 +9,7 @@
<Import_RootNamespace>Roslyn.Test.Utilities</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Assert\ClrOnlyFactAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Assert\EqualityTesting.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Assert\TestExceptionUtilities.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Assert\AssertEx.cs" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册