MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / TestRead

Method TestRead

bufreader/bufreader_test.go:18–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16}
17
18func (s *BufferedReaderTestSuite) TestRead() {
19 data := "hello world"
20 br := bufreader.New(strings.NewReader(data))
21
22 // First read
23 p1 := make([]byte, 5)
24 n1, err1 := br.Read(p1)
25 s.Require().NoError(err1)
26 s.Equal(5, n1)
27 s.Equal("hello", string(p1))
28
29 // Second read
30 p2 := make([]byte, 6)
31 n2, err2 := br.Read(p2)
32 s.Require().NoError(err2)
33 s.Equal(6, n2)
34 s.Equal(" world", string(p2))
35
36 // Verify position
37 s.Equal(11, br.Pos())
38}
39
40func (s *BufferedReaderTestSuite) TestEOF() {
41 data := "hello"

Callers

nothing calls this directly

Calls 3

NewFunction · 0.92
PosMethod · 0.80
ReadMethod · 0.45

Tested by

no test coverage detected