MCPcopy
hub / github.com/go-yaml/yaml / TestSetIndent

Method TestSetIndent

encode_test.go:648–657  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

646}
647
648func (s *S) TestSetIndent(c *C) {
649 var buf bytes.Buffer
650 enc := yaml.NewEncoder(&buf)
651 enc.SetIndent(8)
652 err := enc.Encode(map[string]interface{}{"a": map[string]interface{}{"b": map[string]string{"c": "d"}}})
653 c.Assert(err, Equals, nil)
654 err = enc.Close()
655 c.Assert(err, Equals, nil)
656 c.Assert(buf.String(), Equals, "a:\n b:\n c: d\n")
657}
658
659func (s *S) TestSortedOutput(c *C) {
660 order := []interface{}{

Callers

nothing calls this directly

Calls 4

SetIndentMethod · 0.95
EncodeMethod · 0.95
CloseMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected