bufreader: fix Rewind+Read after EOF; Fix too much data read in fetch

This commit is contained in:
DarthSim
2025-08-15 18:54:58 +03:00
committed by Sergei Aleksandrovich
parent a3c633f884
commit 2f40a9b430
2 changed files with 32 additions and 11 deletions

View File

@@ -64,6 +64,15 @@ func (s *BufferedReaderTestSuite) TestEOF_WhenDataExhausted() {
s.Require().NoError(err)
s.Equal(5, n)
s.Equal("hello", string(p[:n]))
br.Rewind() // Reset position to 0
// We shouldn't get EOF after rewinding and reading again
n, err = br.Read(p)
s.Require().NoError(err)
s.Equal(5, n)
s.Equal("hello", string(p[:n]))
}
func (s *BufferedReaderTestSuite) TestPeek() {