From 31f920a06aa5d7e7cf363645dac02f6e798fffb1 Mon Sep 17 00:00:00 2001 From: Joshua Sjoding Date: Sat, 27 Feb 2016 14:07:22 -0800 Subject: Improved objfile error handling and test coverage --- formats/objfile/reader_test.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'formats/objfile/reader_test.go') diff --git a/formats/objfile/reader_test.go b/formats/objfile/reader_test.go index 871eefe..caebb60 100644 --- a/formats/objfile/reader_test.go +++ b/formats/objfile/reader_test.go @@ -35,9 +35,12 @@ func testReader(c *C, source io.Reader, hash core.Hash, typ core.ObjectType, con rc, err := ioutil.ReadAll(r) c.Assert(err, IsNil) c.Assert(rc, DeepEquals, content, Commentf("%scontent=%s, expected=%s", base64.StdEncoding.EncodeToString(rc), base64.StdEncoding.EncodeToString(content))) + c.Assert(r.Size(), Equals, int64(len(content))) c.Assert(r.Hash(), Equals, hash) // Test Hash() before close c.Assert(r.Close(), IsNil) c.Assert(r.Hash(), Equals, hash) // Test Hash() after close + _, err = r.Read(make([]byte, 0, 1)) + c.Assert(err, Equals, ErrClosed) } func (s *SuiteReader) TestReadEmptyObjfile(c *C) { -- cgit