@@ -792,7 +792,7 @@ public void A_root_command_can_be_omitted_from_the_parsed_args()
792
792
}
793
793
794
794
[ Fact ]
795
- public void A_root_command_can_match_a_full_path_to_an_executable ( )
795
+ public void When_parsing_an_unsplit_string_then_input_a_full_path_to_an_executable_is_matched_by_the_root_command ( )
796
796
{
797
797
var command = new RootCommand
798
798
{
@@ -802,15 +802,15 @@ public void A_root_command_can_match_a_full_path_to_an_executable()
802
802
}
803
803
} ;
804
804
805
- ParseResult result1 = command . Parse ( "inner -x hello" ) ;
805
+ var result1 = command . Parse ( "inner -x hello" ) ;
806
806
807
- ParseResult result2 = command . Parse ( $ "{ RootCommand . ExecutablePath } inner -x hello") ;
807
+ var result2 = command . Parse ( $ "{ RootCommand . ExecutablePath } inner -x hello") ;
808
808
809
809
result1 . Diagram ( ) . Should ( ) . Be ( result2 . Diagram ( ) ) ;
810
810
}
811
811
812
812
[ Fact ]
813
- public void A_renamed_RootCommand_can_be_omitted_from_the_parsed_args ( )
813
+ public void When_parsing_an_unsplit_string_then_a_renamed_RootCommand_can_be_omitted_from_the_parsed_args ( )
814
814
{
815
815
var rootCommand = new RootCommand
816
816
{
@@ -828,6 +828,27 @@ public void A_renamed_RootCommand_can_be_omitted_from_the_parsed_args()
828
828
result2 . RootCommandResult . Command . Should ( ) . BeSameAs ( result1 . RootCommandResult . Command ) ;
829
829
result3 . RootCommandResult . Command . Should ( ) . BeSameAs ( result1 . RootCommandResult . Command ) ;
830
830
}
831
+
832
+ [ Fact ]
833
+ public void When_parsing_a_string_array_input_then_a_full_path_to_an_executable_is_not_matched_by_the_root_command ( )
834
+ {
835
+ var command = new RootCommand
836
+ {
837
+ new Command ( "inner" )
838
+ {
839
+ new Option ( "-x" ) { Arity = ArgumentArity . ExactlyOne }
840
+ }
841
+ } ;
842
+
843
+ command . Parse ( Split ( "inner -x hello" ) ) . Errors . Should ( ) . BeEmpty ( ) ;
844
+
845
+ command . Parse ( Split ( $ "{ RootCommand . ExecutablePath } inner -x hello") )
846
+ . Errors
847
+ . Should ( )
848
+ . ContainSingle ( e => e . Message == $ "{ LocalizationResources . Instance . UnrecognizedCommandOrArgument ( RootCommand . ExecutablePath ) } ") ;
849
+
850
+ string [ ] Split ( string value ) => CommandLineStringSplitter . Instance . Split ( value ) . ToArray ( ) ;
851
+ }
831
852
832
853
[ Fact ]
833
854
public void Absolute_unix_style_paths_are_lexed_correctly ( )
0 commit comments