@@ -841,36 +841,46 @@ fn test_simple_expand_tab_with_both_arguments() {
841841#[ test]
842842fn test_invalid_expand_tab_arguments ( ) {
843843 let test_file_path = "empty_test_file" ;
844- // incorrect argument
845- new_ucmd ! ( )
846- . args ( & [ "-esdgjiojiosdgjiogd" , test_file_path] )
847- . fails ( )
848- . stderr_contains ( "pr: '-e' extra characters or invalid number in the argument: ‘dgjiojiosdgjiogd’\n Try 'pr --help' for more information." ) ;
849- // non digit 2 parameter
850- new_ucmd ! ( )
851- . args ( & [ "-eab" , test_file_path] )
852- . fails ( )
853- . stderr_contains ( "pr: '-e' extra characters or invalid number in the argument: ‘b’\n Try 'pr --help' for more information." ) ;
854- // non digit after first digit
855- new_ucmd ! ( )
856- . args ( & [ "-e1a" , test_file_path] )
857- . fails ( )
858- . stderr_contains ( "pr: '-e' extra characters or invalid number in the argument: ‘1a’\n Try 'pr --help' for more information." ) ;
859- // non digit after first digit
860- new_ucmd ! ( )
861- . args ( & [ "-ea1a" , test_file_path] )
862- . fails ( )
863- . stderr_contains ( "pr: '-e' extra characters or invalid number in the argument: ‘1a’\n Try 'pr --help' for more information." ) ;
864- // > i32 max
865- new_ucmd ! ( )
866- . args ( & [ "-e2147483648" , test_file_path] )
867- . fails ( )
868- . stderr_contains ( "pr: '-e' extra characters or invalid number in the argument: ‘2147483648’\n Try 'pr --help' for more information." ) ;
869- // > i32 max after allowed input char
870- new_ucmd ! ( )
871- . args ( & [ "-ea2147483648" , test_file_path] )
872- . fails ( )
873- . stderr_contains ( "pr: '-e' extra characters or invalid number in the argument: ‘2147483648’\n Try 'pr --help' for more information." ) ;
844+
845+ let test_cases = vec ! [
846+ // incorrect argument
847+ (
848+ "-esdgjiojiosdgjiogd" ,
849+ "pr: '-e' extra characters or invalid number in the argument: ‘dgjiojiosdgjiogd’\n Try 'pr --help' for more information." ,
850+ ) ,
851+ // 2 non digit parameter
852+ (
853+ "-eab" ,
854+ "pr: '-e' extra characters or invalid number in the argument: ‘b’\n Try 'pr --help' for more information." ,
855+ ) ,
856+ // non digit after first digit
857+ (
858+ "-e1a" ,
859+ "pr: '-e' extra characters or invalid number in the argument: ‘1a’\n Try 'pr --help' for more information." ,
860+ ) ,
861+ // non digit after first digit after allowed input char
862+ (
863+ "-ea1a" ,
864+ "pr: '-e' extra characters or invalid number in the argument: ‘1a’\n Try 'pr --help' for more information." ,
865+ ) ,
866+ // > i32 max
867+ (
868+ "-e2147483648" ,
869+ "pr: '-e' extra characters or invalid number in the argument: ‘2147483648’\n Try 'pr --help' for more information." ,
870+ ) ,
871+ // > i32 max after allowed input char
872+ (
873+ "-ea2147483648" ,
874+ "pr: '-e' extra characters or invalid number in the argument: ‘2147483648’\n Try 'pr --help' for more information." ,
875+ ) ,
876+ ] ;
877+
878+ for ( arg, error_msg) in test_cases {
879+ new_ucmd ! ( )
880+ . args ( & [ arg, test_file_path] )
881+ . fails ( )
882+ . stderr_contains ( error_msg) ;
883+ }
874884}
875885/* cSpell:enable */
876886
0 commit comments