Skip to content

Commit 93332f5

Browse files
authored
remove redundant rethrow (#35)
1 parent 7e788fc commit 93332f5

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/stream.jl

-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ function Base.open(f::Function, ::Type{T}, args...) where T<:TranscodingStream
150150
stream = T(open(args...))
151151
try
152152
f(stream)
153-
catch
154-
rethrow()
155153
finally
156154
close(stream)
157155
end

test/runtests.jl

+10-10
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,14 @@ end
128128

129129
# TODO: This should be moved to CodecZlib.jl.
130130
import CodecZlib
131-
import CodecZlib: GzipCompression, GzipDecompression
132-
TranscodingStreams.test_chunked_read(GzipCompression, GzipDecompression)
133-
TranscodingStreams.test_chunked_write(GzipCompression, GzipDecompression)
134-
TranscodingStreams.test_roundtrip_fileio(GzipCompression, GzipDecompression)
131+
import CodecZlib: GzipCompressor, GzipDecompressor
132+
TranscodingStreams.test_chunked_read(GzipCompressor, GzipDecompressor)
133+
TranscodingStreams.test_chunked_write(GzipCompressor, GzipDecompressor)
134+
TranscodingStreams.test_roundtrip_fileio(GzipCompressor, GzipDecompressor)
135135

136136
@testset "seek" begin
137-
data = transcode(GzipCompression, b"abracadabra")
138-
stream = TranscodingStream(GzipDecompression(), IOBuffer(data))
137+
data = transcode(GzipCompressor, b"abracadabra")
138+
stream = TranscodingStream(GzipDecompressor(), IOBuffer(data))
139139
seekstart(stream)
140140
@test read(stream, 3) == b"abr"
141141
seekstart(stream)
@@ -145,20 +145,20 @@ TranscodingStreams.test_roundtrip_fileio(GzipCompression, GzipDecompression)
145145
end
146146

147147
@testset "panic" begin
148-
stream = TranscodingStream(GzipDecompression(), IOBuffer("some invalid data"))
148+
stream = TranscodingStream(GzipDecompressor(), IOBuffer("some invalid data"))
149149
@test_throws ErrorException read(stream)
150150
@test_throws ArgumentError eof(stream)
151151
end
152152

153153
@testset "open" begin
154-
open(CodecZlib.GzipDecompressionStream, joinpath(dirname(@__FILE__), "abra.gzip")) do stream
154+
open(CodecZlib.GzipDecompressorStream, joinpath(dirname(@__FILE__), "abra.gzip")) do stream
155155
@test read(stream) == b"abracadabra"
156156
end
157157
end
158158

159159
@testset "stats" begin
160160
size = filesize(joinpath(dirname(@__FILE__), "abra.gzip"))
161-
stream = CodecZlib.GzipDecompressionStream(open(joinpath(dirname(@__FILE__), "abra.gzip")))
161+
stream = CodecZlib.GzipDecompressorStream(open(joinpath(dirname(@__FILE__), "abra.gzip")))
162162
stats = TranscodingStreams.stats(stream)
163163
@test stats.in == 0
164164
@test stats.out == 0
@@ -174,7 +174,7 @@ end
174174
@test_throws ArgumentError TranscodingStreams.stats(stream)
175175

176176
buf = IOBuffer()
177-
stream = CodecZlib.GzipCompressionStream(buf)
177+
stream = CodecZlib.GzipCompressorStream(buf)
178178
stats = TranscodingStreams.stats(stream)
179179
@test stats.in == 0
180180
@test stats.out == 0

0 commit comments

Comments
 (0)