File tree 1 file changed +28
-0
lines changed
tests/CommandLine.Tests/Unit
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -538,6 +538,34 @@ public void When_IgnoreUnknownArguments_is_set_valid_unknown_arguments_avoid_a_f
538
538
// Teardown
539
539
}
540
540
541
+ [ Fact ]
542
+ public void Properly_formatted_help_screen_excludes_help_as_unknown_option ( )
543
+ {
544
+ // Fixture setup
545
+ var help = new StringWriter ( ) ;
546
+ var sut = new Parser ( config => config . HelpWriter = help ) ;
547
+
548
+ // Exercize system
549
+ sut . ParseArguments < Add_Verb , Commit_Verb , Clone_Verb > (
550
+ new [ ] { "clone" , "--bad-arg" , "--help" } ) ;
551
+ var result = help . ToString ( ) ;
552
+
553
+ // Verify outcome
554
+ var lines = result . ToNotEmptyLines ( ) . TrimStringArray ( ) ;
555
+ lines [ 0 ] . Should ( ) . StartWithEquivalent ( "CommandLine" ) ;
556
+ lines [ 1 ] . ShouldBeEquivalentTo ( "Copyright (c) 2005 - 2015 Giacomo Stelluti Scala" ) ;
557
+ lines [ 2 ] . ShouldBeEquivalentTo ( "ERROR(S):" ) ;
558
+ lines [ 3 ] . ShouldBeEquivalentTo ( "Option 'bad-arg' is unknown." ) ;
559
+ lines [ 4 ] . ShouldBeEquivalentTo ( "--no-hardlinks Optimize the cloning process from a repository on a local" ) ;
560
+ lines [ 5 ] . ShouldBeEquivalentTo ( "filesystem by copying files." ) ;
561
+ lines [ 6 ] . ShouldBeEquivalentTo ( "-q, --quiet Suppress summary message." ) ;
562
+ lines [ 7 ] . ShouldBeEquivalentTo ( "--help Display this help screen." ) ;
563
+ lines [ 8 ] . ShouldBeEquivalentTo ( "--version Display version information." ) ;
564
+ lines [ 9 ] . ShouldBeEquivalentTo ( "value pos. 0" ) ;
565
+
566
+ // Teardown
567
+ }
568
+
541
569
public static IEnumerable < object > IgnoreUnknownArgumentsData
542
570
{
543
571
get
You can’t perform that action at this time.
0 commit comments