(c *C)
| 280 | } |
| 281 | |
| 282 | func (s *IndexSuite) TestDecodeTruncatedExt(c *C) { |
| 283 | idx := s.readSimpleIndex(c) |
| 284 | |
| 285 | buf := bytes.NewBuffer(nil) |
| 286 | e := NewEncoder(buf) |
| 287 | |
| 288 | err := e.encode(idx, false) |
| 289 | c.Assert(err, IsNil) |
| 290 | |
| 291 | _, err = e.w.Write([]byte("TEST")) |
| 292 | c.Assert(err, IsNil) |
| 293 | |
| 294 | err = binary.WriteUint32(e.w, uint32(100)) |
| 295 | c.Assert(err, IsNil) |
| 296 | |
| 297 | _, err = e.w.Write([]byte("truncated")) |
| 298 | c.Assert(err, IsNil) |
| 299 | |
| 300 | err = e.encodeFooter() |
| 301 | c.Assert(err, IsNil) |
| 302 | |
| 303 | idx = &Index{} |
| 304 | d := NewDecoder(buf) |
| 305 | err = d.Decode(idx) |
| 306 | c.Assert(err, ErrorMatches, io.EOF.Error()) |
| 307 | } |
| 308 | |
| 309 | func (s *IndexSuite) TestDecodeInvalidHash(c *C) { |
| 310 | idx := s.readSimpleIndex(c) |
nothing calls this directly
no test coverage detected