Skip to content

Commit

Permalink
Fix read!(s::IO, a::Vector{UInt8}) to return a
Browse files Browse the repository at this point in the history
  • Loading branch information
tkelman committed Oct 3, 2015
1 parent 19563a3 commit 010df39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions base/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ function read!(s::IO, a::Vector{UInt8})
for i in 1:length(a)
a[i] = read(s, UInt8)
end
return a
end

function read!{T}(s::IO, a::Array{T})
Expand Down
5 changes: 5 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3401,3 +3401,8 @@ b8932 = Vec3_8932(2,2,2)
f13261() = (x = (error("oops"),); +(x...))
g13261() = f13261()
@test_throws ErrorException g13261()

#13433, read!(::IO, a::Vector{UInt8}) should return a
type IO13433 <: IO end
Base.read(::IO13433, ::Type{UInt8}) = 0x01
@test read!(IO13433(), Array(UInt8, 4)) == [0x01, 0x01, 0x01, 0x01]

0 comments on commit 010df39

Please sign in to comment.