-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enclosing run settings arguments to handle whitespace. (#312)
* Enclosing run settings arguments to handle whitespace. * Added Tests. * Fixes for test.cmd to work
- Loading branch information
1 parent
a0c2bb5
commit ea09a2c
Showing
6 changed files
with
141 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
#region Test Assemblies | ||
|
||
[assembly: InternalsVisibleTo("Microsoft.TestPlatform.Build.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] | ||
|
||
#endregion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
test/Microsoft.TestPlatform.Build.UnitTests/Microsoft.TestPlatform.Build.UnitTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<TestPlatformRoot Condition="$(TestPlatformRoot) == ''">$(MSBuildThisFileDirectory)../../</TestPlatformRoot> | ||
<TestProject>true</TestProject> | ||
</PropertyGroup> | ||
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" /> | ||
<PropertyGroup> | ||
<OutputType Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">Exe</OutputType> | ||
<TargetFrameworks>netcoreapp1.0;net46</TargetFrameworks> | ||
<AssemblyName>Microsoft.TestPlatform.Build.UnitTests</AssemblyName> | ||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dnxcore50;portable-net45+win8</PackageTargetFallback> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="**\*.cs" /> | ||
<EmbeddedResource Include="**\*.resx" /> | ||
<EmbeddedResource Include="compiler\resources\**\*" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Microsoft.TestPlatform.CoreUtilities\Microsoft.TestPlatform.CoreUtilities.csproj"> | ||
<FromP2P>true</FromP2P> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\src\Microsoft.TestPlatform.Build\Microsoft.TestPlatform.Build.csproj"> | ||
<FromP2P>true</FromP2P> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Build.Framework"> | ||
<Version>15.1.0-preview-000458-02</Version> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.Build.Utilities.Core"> | ||
<Version>15.1.0-preview-000458-02</Version> | ||
</PackageReference> | ||
</ItemGroup> | ||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' "> | ||
<PackageReference Include="Microsoft.NETCore.App"> | ||
<Version>1.0.0</Version> | ||
</PackageReference> | ||
</ItemGroup> | ||
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' "> | ||
<Reference Include="System.Runtime" /> | ||
<Reference Include="System" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" /> | ||
</ItemGroup> | ||
<Import Project="$(TestPlatformRoot)scripts\build\TestPlatform.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
namespace Microsoft.TestPlatform.Build.UnitTests | ||
{ | ||
public static class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
test/Microsoft.TestPlatform.Build.UnitTests/VsTestTaskTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
namespace Microsoft.TestPlatform.Build.UnitTests | ||
{ | ||
using System.Linq; | ||
|
||
using Microsoft.TestPlatform.Build.Tasks; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
[TestClass] | ||
public class VsTestTaskTests | ||
{ | ||
[TestMethod] | ||
public void CreateArgumentShouldAddDoubleQuotesForCLIRunSettings() | ||
{ | ||
const string arg1 = "RunConfiguration.ResultsDirectory=Path having Space"; | ||
const string arg2 = "MSTest.DeploymentEnabled"; | ||
var vstestTask = new VSTestTask { VSTestCLIRunSettings = new string[2] }; | ||
vstestTask.VSTestCLIRunSettings[0] = arg1; | ||
vstestTask.VSTestCLIRunSettings[1] = arg2; | ||
|
||
// Add values for required properties. | ||
vstestTask.TestFileFullPath = "abc"; | ||
vstestTask.VSTestFramework = "abc"; | ||
|
||
var result = vstestTask.CreateArgument().ToArray(); | ||
|
||
// First, second and third args would be --framework:abc, testfilepath and -- respectively. | ||
Assert.AreEqual($"\"{arg1}\"", result[3]); | ||
Assert.AreEqual($"\"{arg2}\"", result[4]); | ||
} | ||
} | ||
} |