File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1427,6 +1427,32 @@ fn test_mv_overwrite_nonempty_dir() {
14271427 assert ! ( at. dir_exists( dir_b) ) ;
14281428}
14291429
1430+ #[ test]
1431+ fn test_mv_overwrite_nonempty_dir_error ( ) {
1432+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
1433+ let dir_a = "test_mv_overwrite_nonempty_dir_error_a" ;
1434+ let dir_b = "test_mv_overwrite_nonempty_dir_error_b" ;
1435+ let shared_dir = "dir" ;
1436+ let dummy_dir_a = & format ! ( "{dir_a}/{shared_dir}" ) ;
1437+ let dummy_dir_b = & format ! ( "{dir_b}/{shared_dir}" ) ;
1438+ let dummy_file = & format ! ( "{dir_b}/{shared_dir}/file" ) ;
1439+
1440+ at. mkdir ( dir_a) ;
1441+ at. mkdir ( dummy_dir_a) ;
1442+ at. mkdir ( dir_b) ;
1443+ at. mkdir ( dummy_dir_b) ;
1444+ at. touch ( dummy_file) ;
1445+
1446+ // Not same error as GNU; the error message is a rust builtin as mentioned in
1447+ // https://github.com/uutils/coreutils/issues/5102
1448+ // Current: "mv: cannot overwrite: A non-empty directory: 'b' exists at destination"
1449+ // GNU: "mv: cannot overwrite 'b': Directory not empty"
1450+
1451+ let result = ucmd. arg ( dummy_dir_a) . arg ( dir_b) . fails ( ) . stderr_is ( format ! (
1452+ "mv: cannot overwrite: A non-empty directory: '{dummy_dir_b}' exists at destination\n "
1453+ ) ) ;
1454+ }
1455+
14301456#[ test]
14311457fn test_mv_backup_dir ( ) {
14321458 let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
You can’t perform that action at this time.
0 commit comments