Skip to content

Commit 87ac022

Browse files
committed
Added failing test for Issue #225
1 parent f33f59b commit 87ac022

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/CommandLine.Tests/Unit/ParserTests.cs

+28
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,34 @@ public void Properly_formatted_help_screen_is_displayed_when_usage_is_defined_in
474474
// Teardown
475475
}
476476

477+
[Fact]
478+
public void Specific_verb_help_screen_should_be_displayed_regardless_other_argument()
479+
{
480+
// Fixture setup
481+
var help = new StringWriter();
482+
var sut = new Parser(config => config.HelpWriter = help);
483+
484+
// Exercize system
485+
sut.ParseArguments<Add_Verb, Commit_Verb, Clone_Verb>(
486+
new[] { "help", "clone", "extra-arg" });
487+
var result = help.ToString();
488+
489+
// Verify outcome
490+
var lines = result.ToNotEmptyLines().TrimStringArray();
491+
lines[0].Should().StartWithEquivalent("CommandLine");
492+
lines[1].ShouldBeEquivalentTo("Copyright (c) 2005 - 2015 Giacomo Stelluti Scala");
493+
lines[2].ShouldBeEquivalentTo("ERROR(S):");
494+
lines[3].ShouldBeEquivalentTo("Option 'extra-arg' is unknown.");
495+
lines[4].ShouldBeEquivalentTo("--no-hardlinks Optimize the cloning process from a repository on a local");
496+
lines[5].ShouldBeEquivalentTo("filesystem by copying files.");
497+
lines[6].ShouldBeEquivalentTo("-q, --quiet Suppress summary message.");
498+
lines[7].ShouldBeEquivalentTo("--help Display this help screen.");
499+
lines[8].ShouldBeEquivalentTo("--version Display version information.");
500+
lines[9].ShouldBeEquivalentTo("URLS (pos. 0) A list of url(s) to clone.");
501+
502+
// Teardown
503+
}
504+
477505
[Theory]
478506
[MemberData("IgnoreUnknownArgumentsData")]
479507
public void When_IgnoreUnknownArguments_is_set_valid_unknown_arguments_avoid_a_failure_parsing(

0 commit comments

Comments
 (0)