From 7bbef285947a572d5a2133d40bd049e4ef18a895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenta=20Sato=20=28=E4=BD=90=E8=97=A4=20=E5=BB=BA=E5=A4=AA?= =?UTF-8?q?=29?= Date: Mon, 27 Nov 2017 17:50:36 +0900 Subject: [PATCH] fix errors and warnings on Julia 0.7 (#10) --- src/decompression.jl | 2 +- src/libz.jl | 2 +- test/runtests.jl | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/decompression.jl b/src/decompression.jl index 08f361d..8b647cf 100644 --- a/src/decompression.jl +++ b/src/decompression.jl @@ -32,7 +32,7 @@ function GzipDecompressor(;windowbits::Integer=Z_DEFAULT_WINDOWBITS, gziponly::B if !(8 ≤ windowbits ≤ 15) throw(ArgumentError("windowbits must be within 8..15")) end - return GzipDecompressor(ZStream(), windowbits+(gziponly?16:32)) + return GzipDecompressor(ZStream(), windowbits+(gziponly ? 16 : 32)) end const GzipDecompressorStream{S} = TranscodingStream{GzipDecompressor,S} where S<:IO diff --git a/src/libz.jl b/src/libz.jl index f61ceb6..e829d45 100644 --- a/src/libz.jl +++ b/src/libz.jl @@ -55,7 +55,7 @@ const Z_DEFAULT_STRATEGY = Cint(0) const Z_DEFAULT_MEMLEVEL = Cint(8) const Z_DEFAULT_WINDOWBITS = Cint(15) -if is_windows() +if isdefined(Sys, :iswindows) ? Sys.iswindows() : is_windows() const libz = "zlib1" else const libz = "libz" diff --git a/test/runtests.jl b/test/runtests.jl index 06fb0c1..ea77fde 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -16,13 +16,13 @@ const testdir = @__DIR__ @testset "Gzip Codec" begin codec = GzipCompressor() @test codec isa GzipCompressor - @test ismatch(r"^CodecZlib.GzipCompressor\(level=-1, windowbits=\d+\)$", sprint(show, codec)) + @test ismatch(r"^(CodecZlib\.)?GzipCompressor\(level=-1, windowbits=\d+\)$", sprint(show, codec)) @test CodecZlib.initialize(codec) === nothing @test CodecZlib.finalize(codec) === nothing codec = GzipDecompressor() @test codec isa GzipDecompressor - @test ismatch(r"^CodecZlib.GzipDecompressor\(windowbits=\d+\)$", sprint(show, codec)) + @test ismatch(r"^(CodecZlib\.)?GzipDecompressor\(windowbits=\d+\)$", sprint(show, codec)) @test CodecZlib.initialize(codec) === nothing @test CodecZlib.finalize(codec) === nothing @@ -118,13 +118,13 @@ end @testset "Zlib Codec" begin codec = ZlibCompressor() @test codec isa ZlibCompressor - @test ismatch(r"^CodecZlib\.ZlibCompressor\(level=-1, windowbits=\d+\)$", sprint(show, codec)) + @test ismatch(r"^(CodecZlib\.)?ZlibCompressor\(level=-1, windowbits=\d+\)$", sprint(show, codec)) @test CodecZlib.initialize(codec) === nothing @test CodecZlib.finalize(codec) === nothing codec = ZlibDecompressor() @test codec isa ZlibDecompressor - @test ismatch(r"^CodecZlib\.ZlibDecompressor\(windowbits=\d+\)$", sprint(show, codec)) + @test ismatch(r"^(CodecZlib\.)?ZlibDecompressor\(windowbits=\d+\)$", sprint(show, codec)) @test CodecZlib.initialize(codec) === nothing @test CodecZlib.finalize(codec) === nothing @@ -198,14 +198,14 @@ end @testset "Deflate Codec" begin codec = DeflateCompressor() @test codec isa DeflateCompressor - @test ismatch(r"^CodecZlib\.DeflateCompressor\(level=-1, windowbits=-\d+\)$", sprint(show, codec)) + @test ismatch(r"^(CodecZlib\.)?DeflateCompressor\(level=-1, windowbits=-\d+\)$", sprint(show, codec)) @test CodecZlib.initialize(codec) === nothing # FIXME: This test fails. #@test CodecZlib.finalize(codec) === nothing codec = DeflateDecompressor() @test codec isa DeflateDecompressor - @test ismatch(r"^CodecZlib\.DeflateDecompressor\(windowbits=-\d+\)$", sprint(show, codec)) + @test ismatch(r"^(CodecZlib\.)?DeflateDecompressor\(windowbits=-\d+\)$", sprint(show, codec)) @test CodecZlib.initialize(codec) === nothing @test CodecZlib.finalize(codec) === nothing