MCPcopy Index your code
hub / github.com/go-git/go-git / testReader

Function testReader

plumbing/format/objfile/reader_test.go:29–45  ·  view source on GitHub ↗
(c *C, source io.Reader, hash plumbing.Hash, t plumbing.ObjectType, content []byte, com string)

Source from the content-addressed store, hash-verified

27}
28
29func testReader(c *C, source io.Reader, hash plumbing.Hash, t plumbing.ObjectType, content []byte, com string) {
30 r, err := NewReader(source)
31 c.Assert(err, IsNil)
32
33 typ, size, err := r.Header()
34 c.Assert(err, IsNil)
35 c.Assert(typ, Equals, t)
36 c.Assert(content, HasLen, int(size))
37
38 rc, err := io.ReadAll(r)
39 c.Assert(err, IsNil)
40 c.Assert(rc, DeepEquals, content, Commentf("%scontent=%s, expected=%s", base64.StdEncoding.EncodeToString(rc), base64.StdEncoding.EncodeToString(content)))
41
42 c.Assert(r.Hash(), Equals, hash) // Test Hash() before close
43 c.Assert(r.Close(), IsNil)
44
45}
46
47func (s *SuiteReader) TestReadEmptyObjfile(c *C) {
48 source := bytes.NewReader([]byte{})

Callers 2

TestReadObjfileMethod · 0.85
TestWriteObjfileMethod · 0.85

Calls 4

HeaderMethod · 0.95
HashMethod · 0.95
CloseMethod · 0.95
NewReaderFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…