@@ -15,7 +15,7 @@ subdir = joinpath(dir, "adir")
1515mkdir (subdir)
1616subdir2 = joinpath (dir, " adir2" )
1717mkdir (subdir2)
18- @test_throws Base. IOError mkdir (file)
18+ @test_throws Base. _UVError ( " mkdir " , Base . UV_EEXIST) mkdir (file)
1919let err = nothing
2020 try
2121 mkdir (file)
@@ -445,9 +445,9 @@ close(f)
445445
446446rm (c_tmpdir, recursive= true )
447447@test ! isdir (c_tmpdir)
448- @test_throws Base. IOError rm (c_tmpdir)
448+ @test_throws Base. _UVError ( " unlink " , Base . UV_ENOENT) rm (c_tmpdir)
449449@test rm (c_tmpdir, force= true ) === nothing
450- @test_throws Base. IOError rm (c_tmpdir, recursive= true )
450+ @test_throws Base. _UVError ( " unlink " , Base . UV_ENOENT) rm (c_tmpdir, recursive= true )
451451@test rm (c_tmpdir, force= true , recursive= true ) === nothing
452452
453453if ! Sys. iswindows ()
@@ -462,8 +462,8 @@ if !Sys.iswindows()
462462 @test stat (file). gid == 0
463463 @test stat (file). uid == 0
464464 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)
467467 end
468468else
469469 # test that chown doesn't cause any errors for Windows
@@ -904,29 +904,31 @@ if !Sys.iswindows() || Sys.windows_version() >= Sys.WINDOWS_VISTA_VER
904904 for src in dirs
905905 for dst in dirs
906906 # 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 )
909909 # 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 )
912912 # mv
913- @test_throws ArgumentError mv (src,dst; force= true )
913+ @test_throws ArgumentError mv (src, dst; force= true )
914914 end
915915 end
916916 end
917917 # None existing src
918918 mktempdir () do tmpdir
919- none_existing_src = joinpath (tmpdir, " none_existing_src " )
919+ nonexisting_src = joinpath (tmpdir, " nonexisting_src " )
920920 dst = joinpath (tmpdir, " dst" )
921- @test ! ispath (none_existing_src )
921+ @test ! ispath (nonexisting_src )
922922 # 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 ))
925927 # 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 )
928930 # 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 )
930932 end
931933end
932934
@@ -1130,13 +1132,13 @@ if !Sys.iswindows()
11301132 for src in files
11311133 for dst in files
11321134 # 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 )
11351137 # 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 )
11381140 # mv
1139- @test_throws ArgumentError mv (src,dst; force= true )
1141+ @test_throws ArgumentError mv (src, dst; force= true )
11401142 end
11411143 end
11421144 end
@@ -1298,7 +1300,8 @@ cd(dirwalk) do
12981300 @test files == [" file1" , " file2" ]
12991301
13001302 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
13021305
13031306 root, dirs, files = take! (chnl_noerror)
13041307 @test root == " ."
@@ -1313,9 +1316,12 @@ cd(dirwalk) do
13131316 # Test that symlink loops don't cause errors
13141317 if has_symlinks
13151318 mkdir (joinpath (" ." , " sub_dir3" ))
1316- symlink (" foo" , joinpath (" ." , " sub_dir3" , " foo" ))
1319+ foo = joinpath (" ." , " sub_dir3" , " foo" )
1320+ symlink (" foo" , foo)
13171321
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
13191325 root, dirs, files = take! (walkdir (joinpath (" ." , " sub_dir3" ); follow_symlinks= false ))
13201326 @test root == joinpath (" ." , " sub_dir3" )
13211327 @test dirs == []
@@ -1504,8 +1510,8 @@ end
15041510 rm (d, recursive= true )
15051511 @test ! ispath (d)
15061512 @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 )
15091515 end
15101516 end
15111517 end
0 commit comments