@@ -445,7 +445,7 @@ macro_rules! compare_with_gnu {
445445}
446446
447447#[ test]
448- fn test_env_with_gnu_reference ( ) {
448+ fn test_env_with_gnu_reference_parsing_errors ( ) {
449449 let ts = TestScenario :: new ( util_name ! ( ) ) ;
450450
451451 compare_with_gnu ! ( ts, & [ "-S\\ |echo hallo" ] ) // no quotes, invalid escape sequence |
@@ -514,19 +514,6 @@ fn test_env_with_gnu_reference() {
514514 . no_stdout ( )
515515 . stderr_is ( "env: invalid sequence '\\ `' in -S\n " ) ;
516516
517- ts. ucmd ( )
518- . args ( & [ "-S\\ '\\ '" ] ) // empty single quotes, considered as program name
519- . fails ( )
520- . code_is ( 127 )
521- . no_stdout ( )
522- . stderr_is ( "env: \" ''\" : No such file or directory\n " ) ; // gnu version again adds escaping here
523-
524- compare_with_gnu ! ( ts, & [ "-S\\ \" \\ \" " ] ) // empty double quotes, considered as program name
525- . failure ( )
526- . code_is ( 127 )
527- . no_stdout ( )
528- . stderr_is ( "env: '\" \" ': No such file or directory\n " ) ;
529-
530517 compare_with_gnu ! ( ts, & [ r#"-S\`"# ] ) // ` escaped without quotes
531518 . failure ( )
532519 . code_is ( 125 )
@@ -553,6 +540,29 @@ fn test_env_with_gnu_reference() {
553540 . stderr_is ( "env: invalid sequence '\\ \u{FFFD} ' in -S\n " ) ; // gnu doesn't show the owl. Instead a invalid unicode ?
554541}
555542
543+ #[ test]
544+ fn test_env_with_gnu_reference_empty_executable_single_quotes ( ) {
545+ let ts = TestScenario :: new ( util_name ! ( ) ) ;
546+
547+ ts. ucmd ( )
548+ . args ( & [ "-S''" ] ) // empty single quotes, considered as program name
549+ . fails ( )
550+ . code_is ( 127 )
551+ . no_stdout ( )
552+ . stderr_is ( "env: '': No such file or directory\n " ) ; // gnu version again adds escaping here
553+ }
554+
555+ #[ test]
556+ fn test_env_with_gnu_reference_empty_executable_double_quotes ( ) {
557+ let ts = TestScenario :: new ( util_name ! ( ) ) ;
558+
559+ compare_with_gnu ! ( ts, & [ "-S\" \" " ] ) // empty double quotes, considered as program name
560+ . failure ( )
561+ . code_is ( 127 )
562+ . no_stdout ( )
563+ . stderr_is ( "env: '': No such file or directory\n " ) ;
564+ }
565+
556566#[ cfg( test) ]
557567mod tests_split_iterator {
558568
0 commit comments