(c *C, source io.Reader, hash plumbing.Hash, t plumbing.ObjectType, content []byte, com string)
| 27 | } |
| 28 | |
| 29 | func 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 | |
| 47 | func (s *SuiteReader) TestReadEmptyObjfile(c *C) { |
| 48 | source := bytes.NewReader([]byte{}) |
no test coverage detected
searching dependent graphs…