From bc5532d3542f71d019f9d547b6f5aaf2c28be9bb Mon Sep 17 00:00:00 2001 From: nhz2 Date: Thu, 21 Mar 2024 20:30:19 -0400 Subject: [PATCH] fix bug --- src/noop.jl | 2 +- test/codecnoop.jl | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/noop.jl b/src/noop.jl index 143a6e4d..5a8caa53 100644 --- a/src/noop.jl +++ b/src/noop.jl @@ -174,7 +174,7 @@ function fillbuffer(stream::NoopStream; eager::Bool = false) changemode!(stream, :read) buffer = stream.buffer1 @assert buffer === stream.buffer2 - if stream.stream isa TranscodingStream && buffer === stream.buffer1 + if stream.stream isa TranscodingStream && buffer === stream.stream.buffer1 # Delegate the operation when buffers are shared. return fillbuffer(stream.stream, eager = eager) end diff --git a/test/codecnoop.jl b/test/codecnoop.jl index a83aa57a..1c4a0d77 100644 --- a/test/codecnoop.jl +++ b/test/codecnoop.jl @@ -139,6 +139,19 @@ @test read(stream) == b"foobar" close(stream) + stream = NoopStream(NoopStream(IOBuffer("foobar")); sharedbuf=false) + @test read(stream) == b"foobar" + close(stream) + + stream = NoopStream(NoopStream(IOBuffer("foobar")); sharedbuf=false) + @test map(x->read(stream, UInt8), 1:6) == b"foobar" + @test eof(stream) + close(stream) + + stream = NoopStream(NoopStream(NoopStream(IOBuffer("foobar")); sharedbuf=false)) + @test read(stream) == b"foobar" + close(stream) + # Two buffers are the same object. stream = NoopStream(IOBuffer("foo")) @test stream.buffer1 === stream.buffer2