Skip to content

Commit

Permalink
Fix seekend method of AnnotatedIOBuffer (#53282)
Browse files Browse the repository at this point in the history
A minor oversight had it returning the underlying IOBuffer originally.
  • Loading branch information
tecosaur authored Feb 12, 2024
1 parent e1a76bb commit 3412c86
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/strings/annotated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ pipe_writer(io::AnnotatedIOBuffer) = io.io
# Useful `IOBuffer` methods that we don't get from `AbstractPipe`
position(io::AnnotatedIOBuffer) = position(io.io)
seek(io::AnnotatedIOBuffer, n::Integer) = (seek(io.io, n); io)
seekend(io::AnnotatedIOBuffer) = seekend(io.io)
seekend(io::AnnotatedIOBuffer) = (seekend(io.io); io)
skip(io::AnnotatedIOBuffer, n::Integer) = (skip(io.io, n); io)
copy(io::AnnotatedIOBuffer) = AnnotatedIOBuffer(copy(io.io), copy(io.annotations))

Expand Down
2 changes: 1 addition & 1 deletion test/strings/annotated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ end
@test read(seek(aio, 1), Base.AnnotatedString) == Base.AnnotatedString("ello world", [(1:4, :tag => 1), (6:10, :tag => 2)])
@test read(seek(aio, 4), Base.AnnotatedString) == Base.AnnotatedString("o world", [(1:1, :tag => 1), (3:7, :tag => 2)])
@test read(seek(aio, 5), Base.AnnotatedString) == Base.AnnotatedString(" world", [(2:6, :tag => 2)])
@test read(aio, Base.AnnotatedString) == Base.AnnotatedString("")
@test read(seekend(aio), Base.AnnotatedString) == Base.AnnotatedString("")
@test read(seekstart(truncate(deepcopy(aio), 5)), Base.AnnotatedString) == Base.AnnotatedString("hello", [(1:5, :tag => 1)])
@test read(seekstart(truncate(deepcopy(aio), 6)), Base.AnnotatedString) == Base.AnnotatedString("hello ", [(1:5, :tag => 1)])
@test read(seekstart(truncate(deepcopy(aio), 7)), Base.AnnotatedString) == Base.AnnotatedString("hello w", [(1:5, :tag => 1), (7:7, :tag => 2)])
Expand Down

0 comments on commit 3412c86

Please sign in to comment.