Merge pull request #5610 from jonsequitur/NonWindowsFactAttribute
use WindowsOnlyTheory where appropriate, introduce NonWindowsOnlyFactAttribute
This commit is contained in:
commit
dfde101b7c
5 changed files with 44 additions and 44 deletions
|
@ -87,7 +87,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding
|
||||||
/// This is a critical scenario for the driver.
|
/// This is a critical scenario for the driver.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="testUserArgument"></param>
|
/// <param name="testUserArgument"></param>
|
||||||
[Theory]
|
[WindowsOnlyTheory]
|
||||||
[InlineData(@"""abc"" d e")]
|
[InlineData(@"""abc"" d e")]
|
||||||
[InlineData(@"""abc"" d e")]
|
[InlineData(@"""abc"" d e")]
|
||||||
[InlineData("\"abc\"\t\td\te")]
|
[InlineData("\"abc\"\t\td\te")]
|
||||||
|
@ -101,11 +101,6 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding
|
||||||
[InlineData(@"a b c""def")]
|
[InlineData(@"a b c""def")]
|
||||||
public void TestArgumentForwardingCmd(string testUserArgument)
|
public void TestArgumentForwardingCmd(string testUserArgument)
|
||||||
{
|
{
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get Baseline Argument Evaluation via Reflector
|
// Get Baseline Argument Evaluation via Reflector
|
||||||
// This does not need to be different for cmd because
|
// This does not need to be different for cmd because
|
||||||
// it only establishes what the string[] args should be
|
// it only establishes what the string[] args should be
|
||||||
|
@ -148,18 +143,13 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[WindowsOnlyTheory]
|
||||||
[InlineData(@"a\""b c d")]
|
[InlineData(@"a\""b c d")]
|
||||||
[InlineData(@"a\\\""b c d")]
|
[InlineData(@"a\\\""b c d")]
|
||||||
[InlineData(@"""\a\"" \\""\\\ b c")]
|
[InlineData(@"""\a\"" \\""\\\ b c")]
|
||||||
[InlineData(@"a\""b \\ cd ""\e f\"" \\""\\\")]
|
[InlineData(@"a\""b \\ cd ""\e f\"" \\""\\\")]
|
||||||
public void TestArgumentForwardingCmdFailsWithUnbalancedQuote(string testArgString)
|
public void TestArgumentForwardingCmdFailsWithUnbalancedQuote(string testArgString)
|
||||||
{
|
{
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get Baseline Argument Evaluation via Reflector
|
// Get Baseline Argument Evaluation via Reflector
|
||||||
// This does not need to be different for cmd because
|
// This does not need to be different for cmd because
|
||||||
// it only establishes what the string[] args should be
|
// it only establishes what the string[] args should be
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
using Microsoft.DotNet.PlatformAbstractions;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
|
{
|
||||||
|
public class NonWindowsOnlyFactAttribute : FactAttribute
|
||||||
|
{
|
||||||
|
public NonWindowsOnlyFactAttribute()
|
||||||
|
{
|
||||||
|
if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows)
|
||||||
|
{
|
||||||
|
this.Skip = "This test requires windows to run";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,15 +16,4 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public class WindowsOnlyTheoryAttribute : TheoryAttribute
|
|
||||||
{
|
|
||||||
public WindowsOnlyTheoryAttribute()
|
|
||||||
{
|
|
||||||
if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows)
|
|
||||||
{
|
|
||||||
this.Skip = "This test requires windows to run";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
using Microsoft.DotNet.PlatformAbstractions;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
|
{
|
||||||
|
public class WindowsOnlyTheoryAttribute : TheoryAttribute
|
||||||
|
{
|
||||||
|
public WindowsOnlyTheoryAttribute()
|
||||||
|
{
|
||||||
|
if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows)
|
||||||
|
{
|
||||||
|
this.Skip = "This test requires windows to run";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,8 +36,8 @@ namespace Microsoft.DotNet.Tests
|
||||||
var projectOutputPath = $"AppWithProjTool2Fx\\bin\\Debug\\net451\\{rid}\\dotnet-desktop-and-portable.exe";
|
var projectOutputPath = $"AppWithProjTool2Fx\\bin\\Debug\\net451\\{rid}\\dotnet-desktop-and-portable.exe";
|
||||||
return new[]
|
return new[]
|
||||||
{
|
{
|
||||||
new object[] { "CoreFX", ".NETCoreApp,Version=v1.0", "lib\\netcoreapp1.0\\dotnet-desktop-and-portable.dll", true },
|
new object[] { "CoreFX", ".NETCoreApp,Version=v1.0", "lib\\netcoreapp1.0\\dotnet-desktop-and-portable.dll" },
|
||||||
new object[] { "NetFX", ".NETFramework,Version=v4.5.1", projectOutputPath, true }
|
new object[] { "NetFX", ".NETFramework,Version=v4.5.1", projectOutputPath }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,8 @@ namespace Microsoft.DotNet.Tests
|
||||||
|
|
||||||
return new[]
|
return new[]
|
||||||
{
|
{
|
||||||
new object[] { "CoreFX", ".NETStandard,Version=v1.6", "lib\\netstandard1.6\\dotnet-desktop-and-portable.dll", true },
|
new object[] { "CoreFX", ".NETStandard,Version=v1.6", "lib\\netstandard1.6\\dotnet-desktop-and-portable.dll" },
|
||||||
new object[] { "NetFX", ".NETFramework,Version=v4.5.1", projectOutputPath, true }
|
new object[] { "NetFX", ".NETFramework,Version=v4.5.1", projectOutputPath }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,16 +196,10 @@ namespace Microsoft.DotNet.Tests
|
||||||
.And.NotHaveStdErr();
|
.And.NotHaveStdErr();
|
||||||
}
|
}
|
||||||
|
|
||||||
// need conditional theories so we can skip on non-Windows
|
[WindowsOnlyTheory(Skip="https://github.com/dotnet/cli/issues/4514")]
|
||||||
//[Theory(Skip="https://github.com/dotnet/cli/issues/4514")]
|
[MemberData("DependencyToolArguments")]
|
||||||
//[MemberData("DependencyToolArguments")]
|
public void TestFrameworkSpecificDependencyToolsCanBeInvoked(string identifier, string framework, string expectedDependencyToolPath)
|
||||||
public void TestFrameworkSpecificDependencyToolsCanBeInvoked(string identifier, string framework, string expectedDependencyToolPath, bool windowsOnly)
|
|
||||||
{
|
{
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && windowsOnly)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var testInstance = TestAssets.Get(TestAssetKinds.DesktopTestProjects, "AppWithProjTool2Fx")
|
var testInstance = TestAssets.Get(TestAssetKinds.DesktopTestProjects, "AppWithProjTool2Fx")
|
||||||
.CreateInstance(identifier: identifier)
|
.CreateInstance(identifier: identifier)
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
@ -227,15 +221,10 @@ namespace Microsoft.DotNet.Tests
|
||||||
.And.Pass();
|
.And.Pass();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[WindowsOnlyTheory]
|
||||||
[MemberData("LibraryDependencyToolArguments")]
|
[MemberData("LibraryDependencyToolArguments")]
|
||||||
public void TestFrameworkSpecificLibraryDependencyToolsCannotBeInvoked(string identifier, string framework, string expectedDependencyToolPath, bool windowsOnly)
|
public void TestFrameworkSpecificLibraryDependencyToolsCannotBeInvoked(string identifier, string framework, string expectedDependencyToolPath)
|
||||||
{
|
{
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && windowsOnly)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var testInstance = TestAssets.Get(TestAssetKinds.DesktopTestProjects, "LibWithProjTool2Fx")
|
var testInstance = TestAssets.Get(TestAssetKinds.DesktopTestProjects, "LibWithProjTool2Fx")
|
||||||
.CreateInstance(identifier: identifier)
|
.CreateInstance(identifier: identifier)
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
|
|
Loading…
Reference in a new issue