Skip to content

Commit b7a45a3

Browse files
committed
Update validation tests with new ZlibError type
Attempts to address downstream breakage introduced in JuliaIO/CodecZlib.jl#93
1 parent 475018e commit b7a45a3

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/convenience.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ below.
2626
- `dir::AbstractString`: a path to a directory to add to the newly created archive.
2727
2828
# Keyword arguments
29-
- `utf8::Bool = true`: use UTF-8 encoding for file names (if `false`, use IBM437).
29+
- `utf8::Bool = true`: use UTF-8 encoding for file names and comments (if `false`, use
30+
IBM437).
3031
- `archive_comment::AbstractString = ""`: archive comment string to add to the central
3132
directory, equivalent to passing the `comment` keyword to `zipsink`.
3233
- `file_options::Dict{String, Any} = nothing`: if a file name added to the archive _exactly_

test/common.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ using Dates
33
using LazyArtifacts
44
using ZipStreams
55

6+
@static if isdefined(CodecZlib, :ZlibError)
7+
const ZlibError = CodecZlib.ZlibError
8+
else
9+
const ZlibError = ErrorException
10+
end
11+
612
function make_file_info(; name::AbstractString="hello.txt", descriptor::Bool=false, utf8::Bool=false, zip64::Bool=false, datetime::DateTime=DateTime(2022, 8, 18, 23, 21, 38), compression::UInt16=ZipStreams.COMPRESSION_STORE)
713
uc_size = 13 % UInt64
814
if compression == ZipStreams.COMPRESSION_DEFLATE

test/test_validate.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ end
146146
zipsource(bad_uncompressed_file) do source
147147
# file is bad
148148
f = next_file(source)
149-
@test_throws ErrorException validate(f)
149+
@test_throws ZlibError validate(f)
150150
end
151151
zipsource(bad_uncompressed_file) do source
152152
# note: this error breaks reading because the zlib codec does not read complete information
153153
for file in source
154-
@test_throws ErrorException read(file)
154+
@test_throws ZlibError read(file)
155155
end
156156
# archive is bad
157157
@test_throws ErrorException validate(source)

0 commit comments

Comments
 (0)