diff --git a/CommandLine.sln b/CommandLine.sln index a8488e86..76c37ff2 100644 --- a/CommandLine.sln +++ b/CommandLine.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandLine", "src\CommandLine\CommandLine.csproj", "{E1BD3C65-49C3-49E7-BABA-C60980CB3F20}" EndProject @@ -23,16 +23,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandLine.Tests", "tests\CommandLine.Tests\CommandLine.Tests.csproj", "{0A15C4D2-B3E9-43AB-8155-1B39F7AC8A5E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandLine.dotnet", "src\CommandLine.dotnet\CommandLine.dotnet.csproj", "{1E72E75F-888A-400E-865C-44251B8013E1}" - ProjectSection(ProjectDependencies) = postProject - {E1BD3C65-49C3-49E7-BABA-C60980CB3F20} = {E1BD3C65-49C3-49E7-BABA-C60980CB3F20} - EndProjectSection -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CommandLine.DotNet.Tests", "tests\CommandLine.DotNet.Tests\CommandLine.DotNet.Tests.xproj", "{C271A22B-B09A-44DA-A82D-8DF49135FA4C}" - ProjectSection(ProjectDependencies) = postProject - {1E72E75F-888A-400E-865C-44251B8013E1} = {1E72E75F-888A-400E-865C-44251B8013E1} - EndProjectSection -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -47,14 +37,6 @@ Global {0A15C4D2-B3E9-43AB-8155-1B39F7AC8A5E}.Debug|Any CPU.Build.0 = Debug|Any CPU {0A15C4D2-B3E9-43AB-8155-1B39F7AC8A5E}.Release|Any CPU.ActiveCfg = Release|Any CPU {0A15C4D2-B3E9-43AB-8155-1B39F7AC8A5E}.Release|Any CPU.Build.0 = Release|Any CPU - {1E72E75F-888A-400E-865C-44251B8013E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1E72E75F-888A-400E-865C-44251B8013E1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1E72E75F-888A-400E-865C-44251B8013E1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1E72E75F-888A-400E-865C-44251B8013E1}.Release|Any CPU.Build.0 = Release|Any CPU - {C271A22B-B09A-44DA-A82D-8DF49135FA4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C271A22B-B09A-44DA-A82D-8DF49135FA4C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C271A22B-B09A-44DA-A82D-8DF49135FA4C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C271A22B-B09A-44DA-A82D-8DF49135FA4C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/global.json b/global.json index 3eb265a4..1035d3fc 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,9 @@ { "projects": [ - "wrap" - ] + "tests/CommandLine.Tests", + "src/CommandLine" + ], + "sdk": { + "version": "1.0.0-preview2-003121" + } } \ No newline at end of file diff --git a/src/CoreCompat.CommandLineParser/project.json b/src/CommandLine/project.json similarity index 100% rename from src/CoreCompat.CommandLineParser/project.json rename to src/CommandLine/project.json diff --git a/tests/CommandLine.DotNet.Tests/CommandLine.DotNet.Tests.xproj b/tests/CommandLine.DotNet.Tests/CommandLine.DotNet.Tests.xproj deleted file mode 100644 index 3aeeb06c..00000000 --- a/tests/CommandLine.DotNet.Tests/CommandLine.DotNet.Tests.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - c271a22b-b09a-44da-a82d-8df49135fa4c - CommandLine.DotNet.Tests - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/tests/CommandLine.DotNet.Tests/project.json b/tests/CommandLine.DotNet.Tests/project.json deleted file mode 100644 index e93e6345..00000000 --- a/tests/CommandLine.DotNet.Tests/project.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "version": "1.0.0-*", - "description": "CommandLine.DotNet.Tests", - - "buildOptions": { - "compile":{ - "include": [ - "../CommandLine.Tests/**/*.cs" - ] - } - }, - - "dependencies": { - "xunit": "2.1.0" - }, - - "testRunner": "xunit", - - "frameworks": { - "netcoreapp1.0": { - "buildOptions": { "define": [ "PLATFORM_DOTNET" ], "keyFile": "../../CommandLine.snk" }, - "dependencies": { - "CommandLine": { - "target": "project", - "version": "" - }, - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0-rc2-3002702" - }, - "System.Reflection": "4.1.0-rc2-24027", - "System.Reflection.TypeExtensions": "4.1.0-rc2-24027", - "FluentAssertions": "4.2.2", - "dotnet-test-xunit": "1.0.0-rc2-build10015" - }, - "imports": [ "dotnet5.4", "dnxcore50", "portable-net451+win81" ] - } - } -} diff --git a/tests/CommandLine.Tests/Fakes/Options_With_FSharpOption.cs b/tests/CommandLine.Tests/Fakes/Options_With_FSharpOption.cs index bb0316f8..7cf66998 100644 --- a/tests/CommandLine.Tests/Fakes/Options_With_FSharpOption.cs +++ b/tests/CommandLine.Tests/Fakes/Options_With_FSharpOption.cs @@ -1,5 +1,6 @@ // Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information. +#if !SKIP_FSHARP using Microsoft.FSharp.Core; namespace CommandLine.Tests.Fakes @@ -13,3 +14,4 @@ public class Options_With_FSharpOption public FSharpOption Offset { get; set; } } } +#endif diff --git a/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs b/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs index c3980550..da6d6c5b 100644 --- a/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs +++ b/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs @@ -4,7 +4,9 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; +#if !SKIP_FSHARP using Microsoft.FSharp.Core; +#endif using CommandLine.Core; using CommandLine.Infrastructure; @@ -697,6 +699,7 @@ public void Parse_nullable_long(string[] arguments, long? expected) // Teardown } +#if !SKIP_FSHARP [Theory] [InlineData(new[] { "--filename", "log-20150626.txt" }, "log-20150626.txt", true)] [InlineData(new string[] { }, null, false)] @@ -738,8 +741,9 @@ public void Parse_fsharp_option_int(string[] arguments, int expectedValue, bool // Teardown } +#endif + - [Fact] public void Min_constraint_set_to_zero_throws_exception() { diff --git a/tests/CommandLine.Tests/Unit/Infrastructure/FSharpOptionHelperTests.cs b/tests/CommandLine.Tests/Unit/Infrastructure/FSharpOptionHelperTests.cs index 8d3a94d5..38e0e86f 100644 --- a/tests/CommandLine.Tests/Unit/Infrastructure/FSharpOptionHelperTests.cs +++ b/tests/CommandLine.Tests/Unit/Infrastructure/FSharpOptionHelperTests.cs @@ -1,5 +1,6 @@ // Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information. +#if !SKIP_FSHARP using System.Reflection; using CommandLine.Infrastructure; using CommandLine.Tests.Fakes; @@ -48,3 +49,4 @@ private PropertyInfo TestData } } } +#endif diff --git a/tests/CommandLine.Tests/Unit/ParserTests.cs b/tests/CommandLine.Tests/Unit/ParserTests.cs index 0989f32c..1a0ce1b4 100644 --- a/tests/CommandLine.Tests/Unit/ParserTests.cs +++ b/tests/CommandLine.Tests/Unit/ParserTests.cs @@ -341,7 +341,12 @@ public void Explicit_version_request_generates_version_info_screen() result.Length.Should().BeGreaterThan(0); var lines = result.ToNotEmptyLines().TrimStringArray(); lines.Should().HaveCount(x => x == 1); +#if !PLATFORM_DOTNET lines[0].Should().StartWithEquivalent("CommandLine"); +#else + // Takes the name of the xUnit test program + lines[0].Should().StartWithEquivalent("xUnit"); +#endif // Teardown } @@ -359,8 +364,14 @@ public void Implicit_help_screen_in_verb_scenario() // Verify outcome result.Length.Should().BeGreaterThan(0); var lines = result.ToNotEmptyLines().TrimStringArray(); +#if !PLATFORM_DOTNET lines[0].Should().StartWithEquivalent("CommandLine"); lines[1].ShouldBeEquivalentTo("Copyright (c) 2005 - 2015 Giacomo Stelluti Scala"); +#else + // Takes the name of the xUnit test program + lines[0].Should().StartWithEquivalent("xUnit"); + lines[1].Should().StartWithEquivalent("Copyright (C) Outercurve Foundation"); +#endif lines[2].ShouldBeEquivalentTo("ERROR(S):"); lines[3].ShouldBeEquivalentTo("No verb selected."); lines[4].ShouldBeEquivalentTo("add Add file contents to the index."); @@ -384,8 +395,14 @@ public void Double_dash_help_dispalys_verbs_index_in_verbs_scenario() // Verify outcome var lines = result.ToNotEmptyLines().TrimStringArray(); +#if !PLATFORM_DOTNET lines[0].Should().StartWithEquivalent("CommandLine"); lines[1].ShouldBeEquivalentTo("Copyright (c) 2005 - 2015 Giacomo Stelluti Scala"); +#else + // Takes the name of the xUnit test program + lines[0].Should().StartWithEquivalent("xUnit"); + lines[1].Should().StartWithEquivalent("Copyright (C) Outercurve Foundation"); +#endif lines[2].ShouldBeEquivalentTo("add Add file contents to the index."); lines[3].ShouldBeEquivalentTo("commit Record changes to the repository."); lines[4].ShouldBeEquivalentTo("clone Clone a repository into a new directory."); @@ -411,7 +428,12 @@ public void Explicit_version_request_generates_version_info_screen_in_verbs_scen result.Length.Should().BeGreaterThan(0); var lines = result.ToNotEmptyLines().TrimStringArray(); lines.Should().HaveCount(x => x == 1); +#if !PLATFORM_DOTNET lines[0].Should().StartWithEquivalent("CommandLine"); +#else + // Takes the name of the xUnit test program + lines[0].Should().StartWithEquivalent("xUnit"); +#endif // Teardown } @@ -428,8 +450,14 @@ public void Errors_of_type_MutuallyExclusiveSetError_are_properly_formatted() // Verify outcome var lines = result.ToNotEmptyLines().TrimStringArray(); +#if !PLATFORM_DOTNET lines[0].Should().StartWithEquivalent("CommandLine"); lines[1].ShouldBeEquivalentTo("Copyright (c) 2005 - 2015 Giacomo Stelluti Scala"); +#else + // Takes the name of the xUnit test program + lines[0].Should().StartWithEquivalent("xUnit"); + lines[1].Should().StartWithEquivalent("Copyright (C) Outercurve Foundation"); +#endif lines[2].ShouldBeEquivalentTo("ERROR(S):"); lines[3].ShouldBeEquivalentTo("Option: 'weburl' is not compatible with: 'ftpurl'."); lines[4].ShouldBeEquivalentTo("Option: 'ftpurl' is not compatible with: 'weburl'."); @@ -471,8 +499,14 @@ public void Properly_formatted_help_screen_is_displayed_when_usage_is_defined_in // Verify outcome var lines = result.ToNotEmptyLines().TrimStringArray(); +#if !PLATFORM_DOTNET lines[0].Should().StartWithEquivalent("CommandLine"); lines[1].ShouldBeEquivalentTo("Copyright (c) 2005 - 2015 Giacomo Stelluti Scala"); +#else + // Takes the name of the xUnit test program + lines[0].Should().StartWithEquivalent("xUnit"); + lines[1].Should().StartWithEquivalent("Copyright (C) Outercurve Foundation"); +#endif lines[2].ShouldBeEquivalentTo("ERROR(S):"); lines[3].ShouldBeEquivalentTo("Option 'badoption' is unknown."); lines[4].ShouldBeEquivalentTo("USAGE:"); @@ -506,8 +540,14 @@ public void Specific_verb_help_screen_should_be_displayed_regardless_other_argum // Verify outcome var lines = result.ToNotEmptyLines().TrimStringArray(); +#if !PLATFORM_DOTNET lines[0].Should().StartWithEquivalent("CommandLine"); lines[1].ShouldBeEquivalentTo("Copyright (c) 2005 - 2015 Giacomo Stelluti Scala"); +#else + // Takes the name of the xUnit test program + lines[0].Should().StartWithEquivalent("xUnit"); + lines[1].Should().StartWithEquivalent("Copyright (C) Outercurve Foundation"); +#endif lines[2].ShouldBeEquivalentTo("--no-hardlinks Optimize the cloning process from a repository on a local"); lines[3].ShouldBeEquivalentTo("filesystem by copying files."); lines[4].ShouldBeEquivalentTo("-q, --quiet Suppress summary message."); @@ -570,8 +610,14 @@ public void Properly_formatted_help_screen_excludes_help_as_unknown_option() // Verify outcome var lines = result.ToNotEmptyLines().TrimStringArray(); +#if !PLATFORM_DOTNET lines[0].Should().StartWithEquivalent("CommandLine"); lines[1].ShouldBeEquivalentTo("Copyright (c) 2005 - 2015 Giacomo Stelluti Scala"); +#else + // Takes the name of the xUnit test program + lines[0].Should().StartWithEquivalent("xUnit"); + lines[1].Should().StartWithEquivalent("Copyright (C) Outercurve Foundation"); +#endif lines[2].ShouldBeEquivalentTo("ERROR(S):"); lines[3].ShouldBeEquivalentTo("Option 'bad-arg' is unknown."); lines[4].ShouldBeEquivalentTo("--no-hardlinks Optimize the cloning process from a repository on a local"); diff --git a/tests/CommandLine.Tests/Unit/Text/HelpTextTests.cs b/tests/CommandLine.Tests/Unit/Text/HelpTextTests.cs index 55535695..ca133501 100644 --- a/tests/CommandLine.Tests/Unit/Text/HelpTextTests.cs +++ b/tests/CommandLine.Tests/Unit/Text/HelpTextTests.cs @@ -275,8 +275,14 @@ public void Invoke_AutoBuild_for_Options_returns_appropriate_formatted_text() // Verify outcome var lines = helpText.ToString().ToNotEmptyLines().TrimStringArray(); +#if !PLATFORM_DOTNET lines[0].Should().StartWithEquivalent("CommandLine"); lines[1].Should().StartWithEquivalent("Copyright (c)"); +#else + // Takes the name of the xUnit test program + lines[0].Should().StartWithEquivalent("xUnit"); + lines[1].Should().StartWithEquivalent("Copyright (C) Outercurve Foundation"); +#endif lines[2].ShouldBeEquivalentTo("ERROR(S):"); lines[3].ShouldBeEquivalentTo("Token 'badtoken' is not recognized."); lines[4].ShouldBeEquivalentTo("A sequence option 'i' is defined with fewer or more items than required."); @@ -305,8 +311,14 @@ public void Invoke_AutoBuild_for_Verbs_with_specific_verb_returns_appropriate_fo // Verify outcome var lines = helpText.ToString().ToNotEmptyLines().TrimStringArray(); +#if !PLATFORM_DOTNET lines[0].Should().StartWithEquivalent("CommandLine"); lines[1].Should().StartWithEquivalent("Copyright (c)"); +#else + // Takes the name of the xUnit test program + lines[0].Should().StartWithEquivalent("xUnit"); + lines[1].Should().StartWithEquivalent("Copyright (C) Outercurve Foundation"); +#endif lines[2].ShouldBeEquivalentTo("-p, --patch Use the interactive patch selection interface to chose which"); lines[3].ShouldBeEquivalentTo("changes to commit."); lines[4].ShouldBeEquivalentTo("--amend Used to amend the tip of the current branch."); @@ -332,8 +344,14 @@ public void Invoke_AutoBuild_for_Verbs_with_unknown_verb_returns_appropriate_for // Verify outcome var lines = helpText.ToString().ToNotEmptyLines().TrimStringArray(); +#if !PLATFORM_DOTNET lines[0].Should().StartWithEquivalent("CommandLine"); lines[1].Should().StartWithEquivalent("Copyright (c)"); +#else + // Takes the name of the xUnit test program + lines[0].Should().StartWithEquivalent("xUnit"); + lines[1].Should().StartWithEquivalent("Copyright (C) Outercurve Foundation"); +#endif lines[2].ShouldBeEquivalentTo("add Add file contents to the index."); lines[3].ShouldBeEquivalentTo("commit Record changes to the repository."); lines[4].ShouldBeEquivalentTo("clone Clone a repository into a new directory."); @@ -412,8 +430,14 @@ public void Invoke_AutoBuild_for_Options_with_Usage_returns_appropriate_formatte // Verify outcome var text = helpText.ToString(); var lines = text.ToNotEmptyLines().TrimStringArray(); +#if !PLATFORM_DOTNET lines[0].Should().StartWithEquivalent("CommandLine"); lines[1].Should().StartWithEquivalent("Copyright (c)"); +#else + // Takes the name of the xUnit test program + lines[0].Should().StartWithEquivalent("xUnit"); + lines[1].Should().StartWithEquivalent("Copyright (C) Outercurve Foundation"); +#endif lines[2].ShouldBeEquivalentTo("ERROR(S):"); lines[3].ShouldBeEquivalentTo("Token 'badtoken' is not recognized."); lines[4].ShouldBeEquivalentTo("USAGE:"); diff --git a/tests/CommandLine.Tests/Unit/UnParserExtensionsTests.cs b/tests/CommandLine.Tests/Unit/UnParserExtensionsTests.cs index da32a342..3d15e2d0 100644 --- a/tests/CommandLine.Tests/Unit/UnParserExtensionsTests.cs +++ b/tests/CommandLine.Tests/Unit/UnParserExtensionsTests.cs @@ -5,7 +5,9 @@ using CommandLine.Tests.Fakes; using Xunit; using FluentAssertions; +#if !SKIP_FSHARP using Microsoft.FSharp.Core; +#endif namespace CommandLine.Tests.Unit { @@ -38,6 +40,7 @@ public static void UnParsing_immutable_instance_returns_command_line(Immutable_S .ShouldBeEquivalentTo(result); } +#if !SKIP_FSHARP [Theory] [MemberData("UnParseDataFSharpOption")] public static void UnParsing_instance_with_fsharp_option_returns_command_line(Options_With_FSharpOption options, string result) @@ -46,6 +49,7 @@ public static void UnParsing_instance_with_fsharp_option_returns_command_line(Op .FormatCommandLine(options) .ShouldBeEquivalentTo(result); } +#endif [Fact] public static void UnParsing_instance_with_group_switches_returns_command_line_with_switches_grouped() @@ -137,6 +141,7 @@ public static IEnumerable UnParseDataImmutable } } +#if !SKIP_FSHARP public static IEnumerable UnParseDataFSharpOption { get @@ -147,5 +152,6 @@ public static IEnumerable UnParseDataFSharpOption yield return new object[] { new Options_With_FSharpOption { FileName = FSharpOption.Some("myfile.bin"), Offset = FSharpOption.Some(123456789) }, "--filename myfile.bin 123456789" }; } } +#endif } } diff --git a/tests/CommandLine.Tests/project.json b/tests/CommandLine.Tests/project.json new file mode 100644 index 00000000..3d5679d7 --- /dev/null +++ b/tests/CommandLine.Tests/project.json @@ -0,0 +1,31 @@ +{ + "version": "1.0.0-*", + "description": "CommandLine.DotNet.Tests", + + "dependencies": { + "xunit": "2.1.0", + "CommandLine": "2.0.275" + }, + + "testRunner": "xunit", + + "frameworks": { + "netcoreapp1.0": { + "buildOptions": { + "define": [ "PLATFORM_DOTNET", "SKIP_FSHARP" ], + "keyFile": "../../CommandLine.snk" + }, + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + }, + "System.Reflection": "4.1.0", + "System.Reflection.TypeExtensions": "4.1.0", + "FluentAssertions": "4.2.2", + "dotnet-test-xunit": "2.2.0-*" + }, + "imports": [ "dotnet5.4", "dnxcore50", "portable-net451+win81" ] + } + } +}