@@ -15,7 +15,7 @@ subdir = joinpath(dir, "adir")
15
15
mkdir (subdir)
16
16
subdir2 = joinpath (dir, " adir2" )
17
17
mkdir (subdir2)
18
- @test_throws Base. IOError mkdir (file)
18
+ @test_throws Base. _UVError ( " mkdir " , Base . UV_EEXIST) mkdir (file)
19
19
let err = nothing
20
20
try
21
21
mkdir (file)
@@ -445,9 +445,9 @@ close(f)
445
445
446
446
rm (c_tmpdir, recursive= true )
447
447
@test ! isdir (c_tmpdir)
448
- @test_throws Base. IOError rm (c_tmpdir)
448
+ @test_throws Base. _UVError (Sys . iswindows () ? " chmod " : " unlink " , Base . UV_ENOENT) rm (c_tmpdir)
449
449
@test rm (c_tmpdir, force= true ) === nothing
450
- @test_throws Base. IOError rm (c_tmpdir, recursive= true )
450
+ @test_throws Base. _UVError (Sys . iswindows () ? " chmod " : " unlink " , Base . UV_ENOENT) rm (c_tmpdir, recursive= true )
451
451
@test rm (c_tmpdir, force= true , recursive= true ) === nothing
452
452
453
453
if ! Sys. iswindows ()
@@ -462,8 +462,8 @@ if !Sys.iswindows()
462
462
@test stat (file). gid == 0
463
463
@test stat (file). uid == 0
464
464
else
465
- @test_throws Base. IOError chown (file, - 2 , - 1 ) # Non-root user cannot change ownership to another user
466
- @test_throws Base. IOError chown (file, - 1 , - 2 ) # Non-root user cannot change group to a group they are not a member of (eg: nogroup)
465
+ @test_throws Base. _UVError ( " chown " , Base . UV_EPERM) chown (file, - 2 , - 1 ) # Non-root user cannot change ownership to another user
466
+ @test_throws Base. _UVError ( " chown " , Base . UV_EPERM) chown (file, - 1 , - 2 ) # Non-root user cannot change group to a group they are not a member of (eg: nogroup)
467
467
end
468
468
else
469
469
# test that chown doesn't cause any errors for Windows
@@ -904,29 +904,31 @@ if !Sys.iswindows() || Sys.windows_version() >= Sys.WINDOWS_VISTA_VER
904
904
for src in dirs
905
905
for dst in dirs
906
906
# cptree
907
- @test_throws ArgumentError Base. cptree (src,dst; force= true , follow_symlinks= false )
908
- @test_throws ArgumentError Base. cptree (src,dst; force= true , follow_symlinks= true )
907
+ @test_throws ArgumentError Base. cptree (src, dst; force= true , follow_symlinks= false )
908
+ @test_throws ArgumentError Base. cptree (src, dst; force= true , follow_symlinks= true )
909
909
# cp
910
- @test_throws ArgumentError cp (src,dst; force= true , follow_symlinks= false )
911
- @test_throws ArgumentError cp (src,dst; force= true , follow_symlinks= true )
910
+ @test_throws ArgumentError cp (src, dst; force= true , follow_symlinks= false )
911
+ @test_throws ArgumentError cp (src, dst; force= true , follow_symlinks= true )
912
912
# mv
913
- @test_throws ArgumentError mv (src,dst; force= true )
913
+ @test_throws ArgumentError mv (src, dst; force= true )
914
914
end
915
915
end
916
916
end
917
917
# None existing src
918
918
mktempdir () do tmpdir
919
- none_existing_src = joinpath (tmpdir, " none_existing_src " )
919
+ nonexisting_src = joinpath (tmpdir, " nonexisting_src " )
920
920
dst = joinpath (tmpdir, " dst" )
921
- @test ! ispath (none_existing_src )
921
+ @test ! ispath (nonexisting_src )
922
922
# cptree
923
- @test_throws ArgumentError Base. cptree (none_existing_src,dst; force= true , follow_symlinks= false )
924
- @test_throws ArgumentError Base. cptree (none_existing_src,dst; force= true , follow_symlinks= true )
923
+ @test_throws (ArgumentError (" '$nonexisting_src ' is not a directory. Use `cp(src, dst)`" ),
924
+ Base. cptree (nonexisting_src, dst; force= true , follow_symlinks= false ))
925
+ @test_throws (ArgumentError (" '$nonexisting_src ' is not a directory. Use `cp(src, dst)`" ),
926
+ Base. cptree (nonexisting_src, dst; force= true , follow_symlinks= true ))
925
927
# cp
926
- @test_throws Base. IOError cp (none_existing_src, dst; force= true , follow_symlinks= false )
927
- @test_throws Base. IOError cp (none_existing_src, dst; force= true , follow_symlinks= true )
928
+ @test_throws Base. _UVError ( " open " , Base . UV_ENOENT) cp (nonexisting_src, dst; force= true , follow_symlinks= false )
929
+ @test_throws Base. _UVError ( " open " , Base . UV_ENOENT) cp (nonexisting_src, dst; force= true , follow_symlinks= true )
928
930
# mv
929
- @test_throws Base. IOError mv (none_existing_src, dst; force= true )
931
+ @test_throws Base. _UVError ( " open " , Base . UV_ENOENT) mv (nonexisting_src, dst; force= true )
930
932
end
931
933
end
932
934
@@ -1130,13 +1132,13 @@ if !Sys.iswindows()
1130
1132
for src in files
1131
1133
for dst in files
1132
1134
# cptree
1133
- @test_throws ArgumentError Base. cptree (src,dst; force= true , follow_symlinks= false )
1134
- @test_throws ArgumentError Base. cptree (src,dst; force= true , follow_symlinks= true )
1135
+ @test_throws ArgumentError Base. cptree (src, dst; force= true , follow_symlinks= false )
1136
+ @test_throws ArgumentError Base. cptree (src, dst; force= true , follow_symlinks= true )
1135
1137
# cp
1136
- @test_throws ArgumentError cp (src,dst; force= true , follow_symlinks= false )
1137
- @test_throws ArgumentError cp (src,dst; force= true , follow_symlinks= true )
1138
+ @test_throws ArgumentError cp (src, dst; force= true , follow_symlinks= false )
1139
+ @test_throws ArgumentError cp (src, dst; force= true , follow_symlinks= true )
1138
1140
# mv
1139
- @test_throws ArgumentError mv (src,dst; force= true )
1141
+ @test_throws ArgumentError mv (src, dst; force= true )
1140
1142
end
1141
1143
end
1142
1144
end
@@ -1298,7 +1300,8 @@ cd(dirwalk) do
1298
1300
@test files == [" file1" , " file2" ]
1299
1301
1300
1302
rm (joinpath (" sub_dir1" ), recursive= true )
1301
- @test_throws TaskFailedException take! (chnl_error) # throws an error because sub_dir1 do not exist
1303
+ @test_throws (Base. _UVError (" readdir" , Base. UV_ENOENT, " with " , repr (joinpath (" ." , " sub_dir1" ))),
1304
+ take! (chnl_error)) # throws an error because sub_dir1 do not exist
1302
1305
1303
1306
root, dirs, files = take! (chnl_noerror)
1304
1307
@test root == " ."
@@ -1313,9 +1316,12 @@ cd(dirwalk) do
1313
1316
# Test that symlink loops don't cause errors
1314
1317
if has_symlinks
1315
1318
mkdir (joinpath (" ." , " sub_dir3" ))
1316
- symlink (" foo" , joinpath (" ." , " sub_dir3" , " foo" ))
1319
+ foo = joinpath (" ." , " sub_dir3" , " foo" )
1320
+ symlink (" foo" , foo)
1317
1321
1318
- @test_throws Base. IOError walkdir (joinpath (" ." , " sub_dir3" ); follow_symlinks= true )
1322
+ let files = walkdir (joinpath (" ." , " sub_dir3" ); follow_symlinks= true )
1323
+ @test_throws Base. _UVError (" stat" , Base. UV_ELOOP, " for file " , repr (foo)) take! (files)
1324
+ end
1319
1325
root, dirs, files = take! (walkdir (joinpath (" ." , " sub_dir3" ); follow_symlinks= false ))
1320
1326
@test root == joinpath (" ." , " sub_dir3" )
1321
1327
@test dirs == []
@@ -1504,8 +1510,8 @@ end
1504
1510
rm (d, recursive= true )
1505
1511
@test ! ispath (d)
1506
1512
@test isempty (readdir ())
1507
- @test_throws SystemError readdir (d)
1508
- @test_throws Base. IOError readdir (join= true )
1513
+ @test_throws Base . _UVError ( " readdir " , Base . UV_ENOENT, " with " , repr (d)) readdir (d)
1514
+ @test_throws Base. _UVError ( " cwd " , Base . UV_ENOENT) readdir (join= true )
1509
1515
end
1510
1516
end
1511
1517
end
0 commit comments