@@ -442,8 +442,12 @@ rm(cfile)
442
442
@non_windowsxp_only begin
443
443
function setup_dirs (tmpdir)
444
444
srcdir = joinpath (tmpdir, " src" )
445
+ hidden_srcdir = joinpath (tmpdir, " .hidden_srcdir" )
446
+ hidden_srcsubdir = joinpath (hidden_srcdir, " .hidden_srcsubdir" )
445
447
srcdir_cp = joinpath (tmpdir, " srcdir_cp" )
446
448
mkdir (srcdir)
449
+ mkdir (hidden_srcdir)
450
+ mkdir (hidden_srcsubdir)
447
451
abs_dirlink = joinpath (tmpdir, " abs_dirlink" )
448
452
symlink (abspath (srcdir), abs_dirlink)
449
453
cd (tmpdir)
@@ -452,16 +456,22 @@ rm(cfile)
452
456
cd (pwd_)
453
457
454
458
cfile = joinpath (srcdir, " c.txt" )
459
+ file_txt = " This is some text with unicode - 这是一个文件"
455
460
open (cfile, " w" ) do cf
456
- write (cf, " This is c.txt with unicode - 这是一个文件" )
461
+ write (cf, file_txt)
462
+ end
463
+ hidden_cfile = joinpath (hidden_srcsubdir, " c.txt" )
464
+ open (hidden_cfile, " w" ) do cf
465
+ write (cf, file_txt)
457
466
end
458
467
459
468
abs_dirlink_cp = joinpath (tmpdir, " abs_dirlink_cp" )
469
+ hidden_srcsubdir_cp = joinpath (tmpdir, " .hidden_srcsubdir_cp" )
460
470
path_rel_dirlink = joinpath (tmpdir, rel_dirlink)
461
471
path_rel_dirlink_cp = joinpath (tmpdir, " rel_dirlink_cp" )
462
472
463
- test_src_paths = [srcdir, abs_dirlink, path_rel_dirlink]
464
- test_cp_paths = [srcdir_cp, abs_dirlink_cp, path_rel_dirlink_cp]
473
+ test_src_paths = [srcdir, hidden_srcsubdir, abs_dirlink, path_rel_dirlink]
474
+ test_cp_paths = [srcdir_cp, hidden_srcsubdir_cp, abs_dirlink_cp, path_rel_dirlink_cp]
465
475
return test_src_paths, test_cp_paths
466
476
end
467
477
@@ -545,11 +555,16 @@ end
545
555
@unix_only begin
546
556
function setup_files (tmpdir)
547
557
srcfile = joinpath (tmpdir, " srcfile.txt" )
558
+ hidden_srcfile = joinpath (tmpdir, " .hidden_srcfile.txt" )
548
559
srcfile_cp = joinpath (tmpdir, " srcfile_cp.txt" )
560
+ hidden_srcfile_cp = joinpath (tmpdir, " .hidden_srcfile_cp.txt" )
561
+ file_txt = " This is some text with unicode - 这是一个文件"
549
562
open (srcfile, " w" ) do f
550
- write (f, " This is srcfile.txt with unicode - 这是一个文件" )
563
+ write (f, file_txt)
564
+ end
565
+ open (hidden_srcfile, " w" ) do f
566
+ write (f, file_txt)
551
567
end
552
- srcfile_content = readall (srcfile)
553
568
abs_filelink = joinpath (tmpdir, " abs_filelink" )
554
569
symlink (abspath (srcfile), abs_filelink)
555
570
cd (tmpdir)
@@ -561,28 +576,28 @@ end
561
576
path_rel_filelink = joinpath (tmpdir, rel_filelink)
562
577
path_rel_filelink_cp = joinpath (tmpdir, " rel_filelink_cp" )
563
578
564
- test_src_paths = [srcfile, abs_filelink, path_rel_filelink]
565
- test_cp_paths = [srcfile_cp, abs_filelink_cp, path_rel_filelink_cp]
566
- return test_src_paths, test_cp_paths, srcfile_content
579
+ test_src_paths = [srcfile, hidden_srcfile, abs_filelink, path_rel_filelink]
580
+ test_cp_paths = [srcfile_cp, hidden_srcfile_cp, abs_filelink_cp, path_rel_filelink_cp]
581
+ return test_src_paths, test_cp_paths, file_txt
567
582
end
568
583
569
- function cp_follow_symlinks_false_check (s, d, srcfile_content ; remove_destination= false )
584
+ function cp_follow_symlinks_false_check (s, d, file_txt ; remove_destination= false )
570
585
cp (s, d; remove_destination= remove_destination, follow_symlinks= false )
571
586
@test isfile (s) == isfile (d)
572
587
@test islink (s) == islink (d)
573
588
islink (s) && @test readlink (s) == readlink (d)
574
589
islink (s) && @test isabspath (readlink (s)) == isabspath (readlink (d))
575
590
# all should contain the same
576
- @test readall (s) == readall (d) == srcfile_content
591
+ @test readall (s) == readall (d) == file_txt
577
592
end
578
593
579
594
# # Test require `remove_destination=true` (remove destination first) for existing
580
595
# files and existing links to files
581
596
mktempdir () do tmpdir
582
597
# Setup new copies for the test
583
- test_src_paths, test_cp_paths, srcfile_content = setup_files (tmpdir)
598
+ test_src_paths, test_cp_paths, file_txt = setup_files (tmpdir)
584
599
for (s, d) in zip (test_src_paths, test_cp_paths)
585
- cp_follow_symlinks_false_check (s, d, srcfile_content )
600
+ cp_follow_symlinks_false_check (s, d, file_txt )
586
601
end
587
602
# Test require `remove_destination=true`
588
603
for s in test_src_paths
593
608
end
594
609
# Test remove the existing path first and copy: follow_symlinks=false
595
610
for (s, d) in zip (test_src_paths, test_cp_paths)
596
- cp_follow_symlinks_false_check (s, d, srcfile_content ; remove_destination= true )
611
+ cp_follow_symlinks_false_check (s, d, file_txt ; remove_destination= true )
597
612
end
598
613
# Test remove the existing path first and copy an other file
599
614
otherfile = joinpath (tmpdir, " otherfile.txt" )
0 commit comments