@@ -429,12 +429,11 @@ fn test_mv_replace_symlink_with_symlink() {
429429fn test_mv_replace_symlink_with_directory ( ) {
430430 let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
431431
432- at. mkdir ( "a" ) ;
432+ at. touch ( "a" ) ;
433433 at. mkdir ( "b" ) ;
434- at. touch ( "a/empty_file_a" ) ;
435434 at. touch ( "b/empty_file_b" ) ;
436435
437- at. symlink_dir ( "a" , "symlink" ) ;
436+ at. symlink_file ( "a" , "symlink" ) ;
438437
439438 ucmd. arg ( "-T" )
440439 . arg ( "b" )
@@ -449,25 +448,44 @@ fn test_mv_replace_symlink_with_directory() {
449448fn test_mv_replace_symlink_with_file ( ) {
450449 let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
451450
452- at. mkdir ( "a" ) ;
453- at. touch ( "a/empty_file_a" ) ;
454- at. touch ( "empty_file_b" ) ;
455-
456- at. symlink_dir ( "a" , "symlink" ) ;
451+ at. touch ( "a" ) ;
452+ at. touch ( "b" ) ;
457453
458- assert ! ( at. file_exists ( " symlink/empty_file_a" ) ) ;
454+ at. symlink_file ( "a" , " symlink" ) ;
459455
460456 ucmd. arg ( "-T" )
461- . arg ( "empty_file_b " )
457+ . arg ( "b " )
462458 . arg ( "symlink" )
463459 . succeeds ( )
464460 . no_stderr ( ) ;
465461
466462 assert ! ( at. file_exists( "symlink" ) ) ;
467463 assert ! ( !at. is_symlink( "symlink" ) ) ;
468- assert ! ( !at. file_exists( "empty_file_b" ) ) ;
464+ assert ! ( !at. file_exists( "b" ) ) ;
465+ assert ! ( at. file_exists( "a" ) ) ;
466+ }
467+
468+ #[ test]
469+ #[ cfg( all( unix, not( target_os = "android" ) ) ) ]
470+ fn test_mv_file_to_symlink_directory ( ) {
471+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
472+
473+ at. mkdir ( "a" ) ;
474+ at. touch ( "a/empty_file_a" ) ;
475+ at. touch ( "b" ) ;
476+
477+ at. symlink_dir ( "a" , "symlink" ) ;
478+
479+ assert ! ( at. file_exists( "symlink/empty_file_a" ) ) ;
480+
481+ ucmd. arg ( "b" ) . arg ( "symlink" ) . succeeds ( ) . no_stderr ( ) ;
482+
483+ assert ! ( at. dir_exists( "symlink" ) ) ;
484+ assert ! ( at. is_symlink( "symlink" ) ) ;
485+ assert ! ( at. file_exists( "symlink/b" ) ) ;
486+ assert ! ( !at. file_exists( "b" ) ) ;
469487 assert ! ( at. dir_exists( "a" ) ) ;
470- assert ! ( at. file_exists( "a/empty_file_a " ) ) ;
488+ assert ! ( at. file_exists( "a/b " ) ) ;
471489}
472490
473491#[ test]
0 commit comments