Skip to content

Commit 0010e44

Browse files
authored
drop Julia 0.6 support (#53)
1 parent b197cf0 commit 0010e44

11 files changed

+69
-143
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
*.jl.mem
44
docs/build/
55
docs/site/
6+
/Manifest.toml

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ os:
33
- linux
44
# - osx
55
julia:
6-
- 0.6
76
- 0.7
87
- nightly
98
matrix:

REQUIRE

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
julia 0.6.0
2-
Compat 0.62
1+
julia 0.7

appveyor.yml

-34
This file was deleted.

src/TranscodingStreams.jl

-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
VERSION < v"0.7.0-beta2.199" && __precompile__()
2-
31
module TranscodingStreams
42

53
export
64
TranscodingStream,
75
Noop,
86
NoopStream
97

10-
using Compat
11-
128
include("memory.jl")
139
include("buffer.jl")
1410
include("error.jl")

src/memory.jl

+2-8
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,8 @@ function Base.length(mem::Memory)
1919
return mem.size
2020
end
2121

22-
if VERSION > v"0.7-"
23-
function Base.lastindex(mem::Memory)
24-
return Int(mem.size)
25-
end
26-
else
27-
function Base.endof(mem::Memory)
28-
return Int(mem.size)
29-
end
22+
function Base.lastindex(mem::Memory)
23+
return Int(mem.size)
3024
end
3125

3226
function Base.checkbounds(mem::Memory, i::Integer)

src/stream.jl

+6-21
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,9 @@ end
135135
# Check that mode is valid.
136136
macro checkmode(validmodes)
137137
mode = esc(:mode)
138-
if VERSION v"0.7.0-beta.210"
139-
quote
140-
if !$(foldr((x, y) -> :($(mode) == $(QuoteNode(x)) || $(y)), eval(validmodes), init=false))
141-
throw(ArgumentError(string("invalid mode :", $(mode))))
142-
end
143-
end
144-
else
145-
quote
146-
if !$(foldr((x, y) -> :($(mode) == $(QuoteNode(x)) || $(y)), false, eval(validmodes)))
147-
throw(ArgumentError(string("invalid mode :", $(mode))))
148-
end
138+
quote
139+
if !$(foldr((x, y) -> :($(mode) == $(QuoteNode(x)) || $(y)), eval(validmodes), init=false))
140+
throw(ArgumentError(string("invalid mode :", $(mode))))
149141
end
150142
end
151143
end
@@ -341,16 +333,9 @@ function Base.readbytes!(stream::TranscodingStream, b::AbstractArray{UInt8}, nb=
341333
return filled
342334
end
343335

344-
if VERSION > v"0.7-"
345-
function Base.bytesavailable(stream::TranscodingStream)
346-
ready_to_read!(stream)
347-
return buffersize(stream.state.buffer1)
348-
end
349-
else
350-
function Base.nb_available(stream::TranscodingStream)
351-
ready_to_read!(stream)
352-
return buffersize(stream.state.buffer1)
353-
end
336+
function Base.bytesavailable(stream::TranscodingStream)
337+
ready_to_read!(stream)
338+
return buffersize(stream.state.buffer1)
354339
end
355340

356341
function Base.readavailable(stream::TranscodingStream)

src/testtools.jl

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
# Test Tools
22
# ==========
33

4-
if VERSION v"0.7.0-rc1"
5-
import Test
6-
import Random: seed!, randstring
7-
else
8-
import Base.Test
9-
const seed! = srand
10-
end
4+
import Test
5+
using Random: seed!, randstring
116

127
TEST_RANDOM_SEED = 12345
138

@@ -84,11 +79,7 @@ function test_chunked_read(Encoder, Decoder)
8479
initialize(encoder)
8580
for _ in 1:500
8681
chunks = [rand(alpha, rand(0:100)) for _ in 1:rand(1:100)]
87-
if VERSION v"0.7.0-beta.210"
88-
data = mapfoldl(x->transcode(encoder, x), vcat, chunks, init=UInt8[])
89-
else
90-
data = mapfoldl(x->transcode(encoder, x), vcat, UInt8[], chunks)
91-
end
82+
data = mapfoldl(x->transcode(encoder, x), vcat, chunks, init=UInt8[])
9283
buffer = NoopStream(IOBuffer(data))
9384
ok = true
9485
local stream

test/codecnoop.jl

+41-41
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
source = IOBuffer("foo")
1010
stream = TranscodingStream(Noop(), source)
1111
@test !eof(stream)
12-
@test read(stream) == b"foo"
12+
@test read(stream) == bb"foo"
1313
close(stream)
1414

1515
data = rand(UInt8, 100_000)
@@ -28,15 +28,15 @@
2828
@test read(stream, UInt8) === UInt8('f')
2929
data = Vector{UInt8}(undef, 5)
3030
unsafe_read(stream, pointer(data), 5) === nothing
31-
@test data == b"oobar"
31+
@test data == bb"oobar"
3232
close(stream)
3333

3434
sink = IOBuffer()
3535
stream = TranscodingStream(Noop(), sink)
3636
@test write(stream, "foo") === 3
3737
@test occursin("mode=write", repr(stream))
3838
flush(stream)
39-
@test take!(sink) == b"foo"
39+
@test take!(sink) == bb"foo"
4040
close(stream)
4141

4242
data = rand(UInt8, 100_000)
@@ -49,7 +49,7 @@
4949
@test take!(sink) == data
5050
close(stream)
5151

52-
stream = TranscodingStream(Noop(), IOBuffer(b"foobarbaz"))
52+
stream = TranscodingStream(Noop(), IOBuffer(bb"foobarbaz"))
5353
@test position(stream) === 0
5454
read(stream, UInt8)
5555
@test position(stream) === 1
@@ -71,13 +71,13 @@
7171
@test !ismarked(stream)
7272
close(stream)
7373

74-
stream = TranscodingStream(Noop(), IOBuffer(b"foobarbaz"))
74+
stream = TranscodingStream(Noop(), IOBuffer(bb"foobarbaz"))
7575
seek(stream, 2)
76-
@test read(stream, 3) == b"oba"
76+
@test read(stream, 3) == bb"oba"
7777
seek(stream, 0)
78-
@test read(stream, 3) == b"foo"
78+
@test read(stream, 3) == bb"foo"
7979
seekstart(stream)
80-
@test read(stream, 3) == b"foo"
80+
@test read(stream, 3) == bb"foo"
8181
seekend(stream)
8282
@test eof(stream)
8383
close(stream)
@@ -116,7 +116,7 @@
116116
out = zeros(UInt8, 3)
117117
@test bytesavailable(stream) == 0
118118
@test TranscodingStreams.unsafe_read(stream, pointer(out), 10) == 3
119-
@test out == b"foo"
119+
@test out == bb"foo"
120120
close(stream)
121121

122122
data = rand(UInt8, 1999)
@@ -132,11 +132,11 @@
132132
close(stream)
133133

134134
stream = NoopStream(NoopStream(IOBuffer("foobar")))
135-
@test read(stream) == b"foobar"
135+
@test read(stream) == bb"foobar"
136136
close(stream)
137137

138138
stream = NoopStream(NoopStream(NoopStream(IOBuffer("foobar"))))
139-
@test read(stream) == b"foobar"
139+
@test read(stream) == bb"foobar"
140140
close(stream)
141141

142142
# Two buffers are the same object.
@@ -151,7 +151,7 @@
151151
@test s1.state.buffer1 === s2.state.buffer1 === s3.state.buffer1 ===
152152
s1.state.buffer2 === s2.state.buffer2 === s3.state.buffer2
153153

154-
stream = TranscodingStream(Noop(), IOBuffer(b"foobar"))
154+
stream = TranscodingStream(Noop(), IOBuffer(bb"foobar"))
155155
@test TranscodingStreams.stats(stream).in === Int64(0)
156156
@test TranscodingStreams.stats(stream).out === Int64(0)
157157
read(stream)
@@ -162,7 +162,7 @@
162162
stream = TranscodingStream(Noop(), IOBuffer())
163163
@test TranscodingStreams.stats(stream).in === Int64(0)
164164
@test TranscodingStreams.stats(stream).out === Int64(0)
165-
write(stream, b"foobar")
165+
write(stream, bb"foobar")
166166
flush(stream)
167167
@test TranscodingStreams.stats(stream).in === Int64(6)
168168
@test TranscodingStreams.stats(stream).out === Int64(6)
@@ -176,23 +176,23 @@
176176

177177
stream = NoopStream(IOBuffer("foobar"))
178178
@test bytesavailable(stream) === 0
179-
@test readavailable(stream) == b""
179+
@test readavailable(stream) == bb""
180180
@test read(stream, UInt8) === UInt8('f')
181181
@test bytesavailable(stream) === 5
182-
@test readavailable(stream) == b"oobar"
182+
@test readavailable(stream) == bb"oobar"
183183
close(stream)
184184

185-
data = b""
185+
data = bb""
186186
@test transcode(Noop, data) == data
187187
@test transcode(Noop, data) !== data
188-
data = b"foo"
188+
data = bb"foo"
189189
@test transcode(Noop, data) == data
190190
@test transcode(Noop, data) !== data
191191

192-
data = b""
192+
data = bb""
193193
@test transcode(Noop(), data) == data
194194
@test transcode(Noop(), data) !== data
195-
data = b"foo"
195+
data = bb"foo"
196196
@test transcode(Noop(), data) == data
197197
@test transcode(Noop(), data) !== data
198198

@@ -202,56 +202,56 @@
202202
TranscodingStreams.test_roundtrip_lines(NoopStream, NoopStream)
203203

204204
# switch write => read
205-
stream = NoopStream(Compat.IOBuffer(b"foobar", read=true, write=true))
205+
stream = NoopStream(IOBuffer(bb"foobar", read=true, write=true))
206206
@test_throws ArgumentError begin
207-
write(stream, b"xyz")
207+
write(stream, bb"xyz")
208208
read(stream, 3)
209209
end
210210

211211
# switch read => write
212-
stream = NoopStream(Compat.IOBuffer(b"foobar", read=true, write=true))
212+
stream = NoopStream(IOBuffer(bb"foobar", read=true, write=true))
213213
@test_throws ArgumentError begin
214214
read(stream, 3)
215-
write(stream, b"xyz")
215+
write(stream, bb"xyz")
216216
end
217217

218218
stream = NoopStream(IOBuffer(""))
219-
@test TranscodingStreams.unread(stream, b"foo") === nothing
220-
@test read(stream, 3) == b"foo"
219+
@test TranscodingStreams.unread(stream, bb"foo") === nothing
220+
@test read(stream, 3) == bb"foo"
221221
close(stream)
222222

223223
stream = NoopStream(IOBuffer("foo"))
224-
@test read(stream, 3) == b"foo"
225-
@test TranscodingStreams.unread(stream, b"bar") === nothing
226-
@test read(stream, 3) == b"bar"
224+
@test read(stream, 3) == bb"foo"
225+
@test TranscodingStreams.unread(stream, bb"bar") === nothing
226+
@test read(stream, 3) == bb"bar"
227227
close(stream)
228228

229229
stream = NoopStream(IOBuffer("foobar"))
230-
@test TranscodingStreams.unread(stream, b"baz") === nothing
231-
@test read(stream, 3) == b"baz"
232-
@test read(stream, 3) == b"foo"
233-
@test read(stream, 3) == b"bar"
230+
@test TranscodingStreams.unread(stream, bb"baz") === nothing
231+
@test read(stream, 3) == bb"baz"
232+
@test read(stream, 3) == bb"foo"
233+
@test read(stream, 3) == bb"bar"
234234
@test eof(stream)
235235
close(stream)
236236

237237
stream = NoopStream(IOBuffer("foobar"))
238-
@test read(stream, 3) == b"foo"
239-
@test TranscodingStreams.unread(stream, b"baz") === nothing
240-
@test read(stream, 3) == b"baz"
241-
@test read(stream, 3) == b"bar"
238+
@test read(stream, 3) == bb"foo"
239+
@test TranscodingStreams.unread(stream, bb"baz") === nothing
240+
@test read(stream, 3) == bb"baz"
241+
@test read(stream, 3) == bb"bar"
242242
@test eof(stream)
243243
close(stream)
244244

245245
stream = NoopStream(IOBuffer("foobar"))
246-
@test read(stream, 3) == b"foo"
247-
@test read(stream, 3) == b"bar"
248-
@test TranscodingStreams.unread(stream, b"baz") === nothing
249-
@test read(stream, 3) == b"baz"
246+
@test read(stream, 3) == bb"foo"
247+
@test read(stream, 3) == bb"bar"
248+
@test TranscodingStreams.unread(stream, bb"baz") === nothing
249+
@test read(stream, 3) == bb"baz"
250250
@test eof(stream)
251251
close(stream)
252252

253253
stream = NoopStream(IOBuffer("foobar"))
254-
@test_throws ArgumentError TranscodingStreams.unsafe_unread(stream, pointer(b"foo"), -1)
254+
@test_throws ArgumentError TranscodingStreams.unsafe_unread(stream, pointer(bb"foo"), -1)
255255
close(stream)
256256

257257
stream = NoopStream(IOBuffer(""))

test/codecquadruple.jl

+8-8
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ function TranscodingStreams.minoutsize(
2929
end
3030

3131
@testset "Quadruple Codec" begin
32-
@test transcode(QuadrupleCodec, b"") == b""
33-
@test transcode(QuadrupleCodec, b"a") == b"aaaa"
34-
@test transcode(QuadrupleCodec, b"ab") == b"aaaabbbb"
35-
@test transcode(QuadrupleCodec(), b"") == b""
36-
@test transcode(QuadrupleCodec(), b"a") == b"aaaa"
37-
@test transcode(QuadrupleCodec(), b"ab") == b"aaaabbbb"
32+
@test transcode(QuadrupleCodec, bb"") == bb""
33+
@test transcode(QuadrupleCodec, bb"a") == bb"aaaa"
34+
@test transcode(QuadrupleCodec, bb"ab") == bb"aaaabbbb"
35+
@test transcode(QuadrupleCodec(), bb"") == bb""
36+
@test transcode(QuadrupleCodec(), bb"a") == bb"aaaa"
37+
@test transcode(QuadrupleCodec(), bb"ab") == bb"aaaabbbb"
3838

3939
#=
4040
data = "x"^1024
@@ -43,11 +43,11 @@ end
4343
=#
4444

4545
stream = TranscodingStream(QuadrupleCodec(), NoopStream(IOBuffer("foo")))
46-
@test read(stream) == b"ffffoooooooo"
46+
@test read(stream) == bb"ffffoooooooo"
4747
close(stream)
4848

4949
stream = NoopStream(TranscodingStream(QuadrupleCodec(), NoopStream(IOBuffer("foo"))))
50-
@test read(stream) == b"ffffoooooooo"
50+
@test read(stream) == bb"ffffoooooooo"
5151
close(stream)
5252

5353
# Buffers are shared.

0 commit comments

Comments
 (0)