File tree Expand file tree Collapse file tree 2 files changed +16
-30
lines changed Expand file tree Collapse file tree 2 files changed +16
-30
lines changed Original file line number Diff line number Diff line change @@ -1595,3 +1595,19 @@ fn test_read_dir_infinite_loop() {
15951595 // Check for duplicate errors
15961596 assert ! ( dir. filter( |e| e. is_err( ) ) . take( 2 ) . count( ) < 2 ) ;
15971597}
1598+
1599+ #[ test]
1600+ fn rename_directory ( ) {
1601+ let tmpdir = tmpdir ( ) ;
1602+ let old_path = tmpdir. join ( "foo/bar/baz" ) ;
1603+ fs:: create_dir_all ( & old_path) . unwrap ( ) ;
1604+ let test_file = & old_path. join ( "temp.txt" ) ;
1605+
1606+ File :: create ( test_file) . unwrap ( ) ;
1607+
1608+ let new_path = tmpdir. join ( "quux/blat" ) ;
1609+ fs:: create_dir_all ( & new_path) . unwrap ( ) ;
1610+ fs:: rename ( & old_path, & new_path. join ( "newdir" ) ) . unwrap ( ) ;
1611+ assert ! ( new_path. join( "newdir" ) . is_dir( ) ) ;
1612+ assert ! ( new_path. join( "newdir/temp.txt" ) . exists( ) ) ;
1613+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments