@@ -445,7 +445,7 @@ macro_rules! compare_with_gnu {
445
445
}
446
446
447
447
#[ test]
448
- fn test_env_with_gnu_reference ( ) {
448
+ fn test_env_with_gnu_reference_parsing_errors ( ) {
449
449
let ts = TestScenario :: new ( util_name ! ( ) ) ;
450
450
451
451
compare_with_gnu ! ( ts, & [ "-S\\ |echo hallo" ] ) // no quotes, invalid escape sequence |
@@ -514,19 +514,6 @@ fn test_env_with_gnu_reference() {
514
514
. no_stdout ( )
515
515
. stderr_is ( "env: invalid sequence '\\ `' in -S\n " ) ;
516
516
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
-
530
517
compare_with_gnu ! ( ts, & [ r#"-S\`"# ] ) // ` escaped without quotes
531
518
. failure ( )
532
519
. code_is ( 125 )
@@ -553,6 +540,29 @@ fn test_env_with_gnu_reference() {
553
540
. stderr_is ( "env: invalid sequence '\\ \u{FFFD} ' in -S\n " ) ; // gnu doesn't show the owl. Instead a invalid unicode ?
554
541
}
555
542
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
+
556
566
#[ cfg( test) ]
557
567
mod tests_split_iterator {
558
568
0 commit comments