Skip to content

Commit

Permalink
test closing removes mark
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 committed Mar 31, 2024
1 parent 13dec86 commit d514eb8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ end

function Base.ismarked(stream::TranscodingStream)::Bool
checkmode(stream)
ismarked(stream.buffer1)
isopen(stream) && ismarked(stream.buffer1)
end

function Base.mark(stream::TranscodingStream)::Int64
Expand All @@ -242,7 +242,7 @@ end

function Base.unmark(stream::TranscodingStream)::Bool
checkmode(stream)
unmark!(stream.buffer1)
isopen(stream) && unmark!(stream.buffer1)
end

function Base.reset(stream::T) where T<:TranscodingStream
Expand Down
2 changes: 2 additions & 0 deletions test/codecnoop.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@
@test unmark(stream)
@test !ismarked(stream)
@test !unmark(stream)
@test mark(stream) == 3
close(stream)
@test !ismarked(stream)

stream = TranscodingStream(Noop(), IOBuffer(b"foobarbaz"))
@test stream == seek(stream, 2)
Expand Down
4 changes: 4 additions & 0 deletions test/codecquadruple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ end
end
@test mark(stream) == mark(iob)
@test Base.reset(stream) == Base.reset(iob)
@test mark(stream) == mark(iob)
close(stream)
close(iob)
@test !ismarked(stream)
@test !ismarked(iob)
end
end

Expand Down

0 comments on commit d514eb8

Please sign in to comment.