File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1959,9 +1959,12 @@ fn test_rename_symlink() {
19591959 let tmpdir = tmpdir ( ) ;
19601960 let original = tmpdir. join ( "original" ) ;
19611961 let dest = tmpdir. join ( "dest" ) ;
1962+ let not_exist = Path :: new ( "does not exist" ) ;
19621963
1963- symlink_file ( "does not exist" , & original) . unwrap ( ) ;
1964+ symlink_file ( not_exist , & original) . unwrap ( ) ;
19641965 fs:: rename ( & original, & dest) . unwrap ( ) ;
1966+ // Make sure that copying `original` to `dest` preserves the symlink.
1967+ assert_eq ! ( fs:: read_link( & dest) . unwrap( ) . as_path( ) , not_exist) ;
19651968}
19661969
19671970#[ test]
@@ -1970,7 +1973,12 @@ fn test_rename_junction() {
19701973 let tmpdir = tmpdir ( ) ;
19711974 let original = tmpdir. join ( "original" ) ;
19721975 let dest = tmpdir. join ( "dest" ) ;
1976+ let not_exist = Path :: new ( "does not exist" ) ;
19731977
1974- junction_point ( "does not exist" , & original) . unwrap ( ) ;
1978+ junction_point ( & not_exist , & original) . unwrap ( ) ;
19751979 fs:: rename ( & original, & dest) . unwrap ( ) ;
1980+
1981+ // Make sure that copying `original`` to `dest` preserves the junction point.
1982+ // Junction links are always absolute so we just check the file name is correct.
1983+ assert_eq ! ( fs:: read_link( & dest) . unwrap( ) . file_name( ) , Some ( not_exist. as_os_str( ) ) ) ;
19761984}
You can’t perform that action at this time.
0 commit comments