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 authored and skumagai committed Oct 9, 2015
1 parent e7bcf1d commit 1c91dde
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 @@ -3431,3 +3431,8 @@ end
end
@test f13432b(true) == true
@test f13432b(false) == false

#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 1c91dde

Please sign in to comment.