@@ -41,17 +41,12 @@ fn format_example_option(option: &str) -> String {
4141#[ test]
4242fn when_parsing_filepath_passed_more_than_once_then_return_file_path_specified_more_than_once_error (
4343) {
44- let arguments_without_options = [ String :: from ( FILEPATH ) , String :: from ( FILEPATH ) ] ;
45- expect_file_path_specified_more_than_once_error ( AuthMonitorParams :: from_arguments (
46- & arguments_without_options,
47- ) ) ;
44+ let mut arguments = vec ! [ String :: from( FILEPATH ) , String :: from( FILEPATH ) ] ;
45+ expect_file_path_specified_more_than_once_error ( AuthMonitorParams :: from_arguments ( & arguments) ) ;
4846
49- let mut options = Vec :: from ( ALL_OPTIONS . map ( format_example_option) ) ;
50- let mut arguments_with_options = Vec :: from ( arguments_without_options) ;
51- arguments_with_options. append ( & mut options) ;
52- expect_file_path_specified_more_than_once_error ( AuthMonitorParams :: from_arguments (
53- & arguments_with_options,
54- ) ) ;
47+ let options = ALL_OPTIONS . map ( format_example_option) ;
48+ arguments. extend_from_slice ( & options) ;
49+ expect_file_path_specified_more_than_once_error ( AuthMonitorParams :: from_arguments ( & arguments) ) ;
5550}
5651
5752fn expect_file_path_specified_more_than_once_error ( result : AuthMonitorResult ) {
@@ -179,12 +174,13 @@ fn when_parsing_filename_and_multiple_options_then_return_params_with_parsed_val
179174
180175#[ test]
181176fn when_parsing_unknown_option_then_return_unknown_option_error ( ) {
182- for option in [
177+ let unknown_options = [
183178 "--no-value" ,
184179 "--u=" ,
185180 "--unknown=10" ,
186181 "--unknown-option=test" ,
187- ] {
182+ ] ;
183+ for option in unknown_options {
188184 let arguments = [ String :: from ( FILEPATH ) , String :: from ( option) ] ;
189185 let expected = format ! ( "Unknown option {}" , option) ;
190186 assert_error ! ( AuthMonitorParams :: from_arguments( & arguments) , expected)
0 commit comments