Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
20 changes: 1 addition & 19 deletions CommandLine.sln
Original file line numberDiff line numberDiff line change
@@ -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
Expand All@@ -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
Expand All@@ -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
Expand Down
8 changes: 6 additions & 2 deletions global.json
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
{
"projects": [
"wrap"
]
"tests/CommandLine.Tests",
"src/CommandLine"
],
"sdk":{
"version": "1.0.0-preview2-003121"
}
}
19 changes: 0 additions & 19 deletions tests/CommandLine.DotNet.Tests/CommandLine.DotNet.Tests.xproj

This file was deleted.

39 changes: 0 additions & 39 deletions tests/CommandLine.DotNet.Tests/project.json

This file was deleted.

2 changes: 2 additions & 0 deletions tests/CommandLine.Tests/Fakes/Options_With_FSharpOption.cs
Original file line numberDiff line numberDiff line change
@@ -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
Expand All@@ -13,3 +14,4 @@ public class Options_With_FSharpOption
public FSharpOption<int> Offset{get; set}
}
}
#endif
6 changes: 5 additions & 1 deletion tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -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;

Expand DownExpand Up@@ -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)]
Expand DownExpand Up@@ -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()
{
Expand Down
Original file line numberDiff line numberDiff line change
@@ -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;
Expand DownExpand Up@@ -48,3 +49,4 @@ private PropertyInfo TestData
}
}
}
#endif
46 changes: 46 additions & 0 deletions tests/CommandLine.Tests/Unit/ParserTests.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
}

Expand All@@ -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.");
Expand All@@ -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.");
Expand All@@ -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
}

Expand All@@ -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'.");
Expand DownExpand Up@@ -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:");
Expand DownExpand Up@@ -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.");
Expand DownExpand Up@@ -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");
Expand Down
24 changes: 24 additions & 0 deletions tests/CommandLine.Tests/Unit/Text/HelpTextTests.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.");
Expand DownExpand Up@@ -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.");
Expand All@@ -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.");
Expand DownExpand Up@@ -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:");
Expand Down
6 changes: 6 additions & 0 deletions tests/CommandLine.Tests/Unit/UnParserExtensionsTests.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,9 @@
using CommandLine.Tests.Fakes;
using Xunit;
using FluentAssertions;
#if !SKIP_FSHARP
using Microsoft.FSharp.Core;
#endif

namespace CommandLine.Tests.Unit
{
Expand DownExpand Up@@ -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)
Expand All@@ -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()
Expand DownExpand Up@@ -137,6 +141,7 @@ public static IEnumerable<object> UnParseDataImmutable
}
}

#if !SKIP_FSHARP
public static IEnumerable<object> UnParseDataFSharpOption
{
get
Expand All@@ -147,5 +152,6 @@ public static IEnumerable<object> UnParseDataFSharpOption
yield return new object[]{new Options_With_FSharpOption{FileName = FSharpOption<string>.Some("myfile.bin"), Offset = FSharpOption<int>.Some(123456789) }, "--filename myfile.bin 123456789"};
}
}
#endif
}
}
Loading