diff --git a/base/io.jl b/base/io.jl index e15551cfbdfa7..45faa621f8fa6 100644 --- a/base/io.jl +++ b/base/io.jl @@ -1059,6 +1059,8 @@ eltype(::Type{ReadEachIterator{T}}) where T = T IteratorSize(::Type{<:ReadEachIterator}) = SizeUnknown() +isdone(itr::ReadEachIterator, state...) = eof(itr.stream) + # IOStream Marking # Note that these functions expect that io.mark exists for # the concrete IO type. This may not be true for IO types diff --git a/test/read.jl b/test/read.jl index b7e8c2260a4f9..aa897342393a1 100644 --- a/test/read.jl +++ b/test/read.jl @@ -618,8 +618,7 @@ let p = Pipe() close(p) end -@testset "issue #27412" begin - itr = eachline(IOBuffer("a")) +@testset "issue #27412" for itr in [eachline(IOBuffer("a")), readeach(IOBuffer("a"), Char)] @test !isempty(itr) # check that the earlier isempty did not consume the iterator @test !isempty(itr)