Skip to content

Commit

Permalink
Added tests for BufferStream
Browse files Browse the repository at this point in the history
(cherry picked from commit 070e3c6)
ref #14144
  • Loading branch information
kshyatt authored and tkelman committed Nov 30, 2015
1 parent adf54fa commit 95368ee
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/iobuffer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,21 @@ end
let io = IOBuffer(0)
write(io, ones(UInt8, 1048577))
end

let bstream = BufferStream()
@test isopen(bstream)
@test isreadable(bstream)
@test iswritable(bstream)
@test sprint(io -> show(io,bstream)) == "BufferStream() bytes waiting:$(nb_available(bstream.buffer)), isopen:true"
a = rand(UInt8,10)
write(bstream,a)
flush(bstream)
b = read(bstream,UInt8)
@test a[1] == b
b = read(bstream,UInt8)
@test a[2] == b
c = zeros(UInt8,8)
read!(bstream,c)
@test c == a[3:10]
close(bstream)
end

0 comments on commit 95368ee

Please sign in to comment.