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

Method TestEOF

bufreader/bufreader_test.go:40–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40func (s *BufferedReaderTestSuite) TestEOF() {
41 data := "hello"
42 br := bufreader.New(strings.NewReader(data))
43
44 // Read all data
45 p1 := make([]byte, 5)
46 n1, err1 := br.Read(p1)
47 s.Require().NoError(err1)
48 s.Equal(5, n1)
49 s.Equal("hello", string(p1))
50
51 // Try to read more - should get EOF
52 p2 := make([]byte, 5)
53 n2, err2 := br.Read(p2)
54 s.Equal(io.EOF, err2)
55 s.Equal(0, n2)
56}
57
58func (s *BufferedReaderTestSuite) TestEOF_WhenDataExhausted() {
59 data := "hello"

Callers

nothing calls this directly

Calls 2

NewFunction · 0.92
ReadMethod · 0.45

Tested by

no test coverage detected