File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -2837,6 +2837,26 @@ mod tests {
2837
2837
assert_eq ! ( check!( out_path. metadata( ) ) . len( ) , copied_len) ;
2838
2838
}
2839
2839
2840
+ #[ test]
2841
+ fn copy_file_follows_dst_symlink ( ) {
2842
+ let tmp = tmpdir ( ) ;
2843
+ if !got_symlink_permission ( & tmp) { return } ;
2844
+
2845
+ let in_path = tmp. join ( "in.txt" ) ;
2846
+ let out_path = tmp. join ( "out.txt" ) ;
2847
+ let out_path_symlink = tmp. join ( "out_symlink.txt" ) ;
2848
+
2849
+ check ! ( fs:: write( & in_path, "foo" ) ) ;
2850
+ check ! ( fs:: write( & out_path, "bar" ) ) ;
2851
+ check ! ( symlink_file( & out_path, & out_path_symlink) ) ;
2852
+
2853
+ check ! ( fs:: copy( & in_path, & out_path_symlink) ) ;
2854
+
2855
+ assert ! ( check!( out_path_symlink. symlink_metadata( ) ) . file_type( ) . is_symlink( ) ) ;
2856
+ assert_eq ! ( check!( fs:: read( & out_path_symlink) ) , b"foo" . to_vec( ) ) ;
2857
+ assert_eq ! ( check!( fs:: read( & out_path) ) , b"foo" . to_vec( ) ) ;
2858
+ }
2859
+
2840
2860
#[ test]
2841
2861
fn symlinks_work ( ) {
2842
2862
let tmpdir = tmpdir ( ) ;
You can’t perform that action at this time.
0 commit comments