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() {
1959
1959
let tmpdir = tmpdir ( ) ;
1960
1960
let original = tmpdir. join ( "original" ) ;
1961
1961
let dest = tmpdir. join ( "dest" ) ;
1962
+ let not_exist = Path :: new ( "does not exist" ) ;
1962
1963
1963
- symlink_file ( "does not exist" , & original) . unwrap ( ) ;
1964
+ symlink_file ( not_exist , & original) . unwrap ( ) ;
1964
1965
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) ;
1965
1968
}
1966
1969
1967
1970
#[ test]
@@ -1970,7 +1973,12 @@ fn test_rename_junction() {
1970
1973
let tmpdir = tmpdir ( ) ;
1971
1974
let original = tmpdir. join ( "original" ) ;
1972
1975
let dest = tmpdir. join ( "dest" ) ;
1976
+ let not_exist = Path :: new ( "does not exist" ) ;
1973
1977
1974
- junction_point ( "does not exist" , & original) . unwrap ( ) ;
1978
+ junction_point ( & not_exist , & original) . unwrap ( ) ;
1975
1979
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( ) ) ) ;
1976
1984
}
You can’t perform that action at this time.
0 commit comments