MCPcopy Create free account
hub / github.com/go-git/go-git / TestDecode

Method TestDecode

plumbing/format/config/decoder_test.go:14–26  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

12var _ = Suite(&DecoderSuite{})
13
14func (s *DecoderSuite) TestDecode(c *C) {
15 for idx, fixture := range fixtures {
16 r := bytes.NewReader([]byte(fixture.Raw))
17 d := NewDecoder(r)
18 cfg := &Config{}
19 err := d.Decode(cfg)
20 c.Assert(err, IsNil, Commentf("decoder error for fixture: %d", idx))
21 buf := bytes.NewBuffer(nil)
22 e := NewEncoder(buf)
23 _ = e.Encode(cfg)
24 c.Assert(cfg, DeepEquals, fixture.Config, Commentf("bad result for fixture: %d, %s", idx, buf.String()))
25 }
26}
27
28func (s *DecoderSuite) TestDecodeFailsWithIdentBeforeSection(c *C) {
29 t := `

Callers

nothing calls this directly

Calls 5

DecodeMethod · 0.95
EncodeMethod · 0.95
NewDecoderFunction · 0.70
NewEncoderFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected