File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -2837,6 +2837,26 @@ mod tests {
28372837 assert_eq ! ( check!( out_path. metadata( ) ) . len( ) , copied_len) ;
28382838 }
28392839
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+
28402860 #[ test]
28412861 fn symlinks_work ( ) {
28422862 let tmpdir = tmpdir ( ) ;
You can’t perform that action at this time.
0 commit comments