plumbing/format/config/encoder_test.go
raw| 1 | package config |
| 2 | |
| 3 | import ( |
| 4 | "bytes" |
| 5 | |
| 6 | . "gopkg.in/check.v1" |
| 7 | ) |
| 8 | |
| 9 | type EncoderSuite struct{} |
| 10 | |
| 11 | var _ = Suite(&EncoderSuite{}) |
| 12 | |
| 13 | func (s *EncoderSuite) TestEncode(c *C) { |
| 14 | for idx, fixture := range fixtures { |
| 15 | buf := &bytes.Buffer{} |
| 16 | e := NewEncoder(buf) |
| 17 | err := e.Encode(fixture.Config) |
| 18 | c.Assert(err, IsNil, Commentf("encoder error for fixture: %d", idx)) |
| 19 | c.Assert(buf.String(), Equals, fixture.Text, Commentf("bad result for fixture: %d", idx)) |
| 20 | } |
| 21 | } |