File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -7118,6 +7118,25 @@ fn test_cp_no_dereference_symlink_with_parents() {
71187118 assert_eq ! ( at. resolve_link( "x/symlink-to-directory" ) , "directory" ) ;
71197119}
71207120
7121+ #[ test]
7122+ #[ cfg( unix) ]
7123+ fn test_cp_recursive_no_dereference_symlink_to_directory ( ) {
7124+ let ts = TestScenario :: new ( util_name ! ( ) ) ;
7125+ let at = & ts. fixtures ;
7126+
7127+ at. mkdir ( "source_dir" ) ;
7128+ at. touch ( "source_dir/file.txt" ) ;
7129+ at. symlink_file ( "source_dir" , "symlink_to_dir" ) ;
7130+
7131+ // Copy with -r --no-dereference (or -rP): should copy the symlink, not the directory contents
7132+ ts. ucmd ( )
7133+ . args ( & [ "-r" , "--no-dereference" , "symlink_to_dir" , "dest" ] )
7134+ . succeeds ( ) ;
7135+
7136+ assert ! ( at. is_symlink( "dest" ) ) ;
7137+ assert_eq ! ( at. resolve_link( "dest" ) , "source_dir" ) ;
7138+ }
7139+
71217140#[ test]
71227141#[ cfg( unix) ]
71237142fn test_cp_recursive_files_ending_in_backslash ( ) {
You can’t perform that action at this time.
0 commit comments