Skip to content

Commit

Permalink
Merge pull request #115 from JuliaIO/sk/read-to-the-bitter-end
Browse files Browse the repository at this point in the history
read to the end of tarballs
  • Loading branch information
StefanKarpinski committed Jun 2, 2021
2 parents 97aad16 + e3a0a3a commit 343e923
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -618,13 +618,15 @@ end
file = tempname()
touch(file)
@test_throws ErrorException Tar.extract(tar, file)
read(tar) # consume the rest
rm(file)
end
# extract(tarball, dir) — non-empty directory (error)
@arg_test tar begin
dir = mktempdir()
touch(joinpath(dir, "file"))
@test_throws ErrorException Tar.extract(tar, dir)
read(tar) # consume the rest
rm(dir, recursive=true)
end
end
Expand Down Expand Up @@ -693,13 +695,15 @@ end
file = tempname()
touch(file)
@test_throws ErrorException Tar.extract(predicate, tar, file)
read(tar) # consume the rest
rm(file)
end
# extract(predicate, tarball, dir) — non-empty directory (error)
@arg_test tar begin
dir = mktempdir()
touch(joinpath(dir, "file"))
@test_throws ErrorException Tar.extract(predicate, tar, dir)
read(tar) # consume the rest
rm(dir, recursive=true)
end
end
Expand Down
4 changes: 3 additions & 1 deletion test/setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ function make_test_dir(gen_skip::Bool=false)
fpath = joinpath(dir, "dir", "file")
touch(fpath)
open(fpath, write=true) do io
write(io, rand(UInt8, 1000))
for i = 1:1000
write(io, i % UInt8)
end
end
mkdir(joinpath(dir, "empty"))
if gen_skip
Expand Down

0 comments on commit 343e923

Please sign in to comment.