gitee.com/sy_183/go-common@v1.0.5-0.20231205030221-958cfe129b47/yaml/encode_test.go (about) 1 package yaml 2 3 import ( 4 "gitee.com/sy_183/go-common/assert" 5 "os" 6 "testing" 7 ) 8 9 func TestEncode(t *testing.T) { 10 os.Stdout.Write(assert.Must(Marshal(map[any]any{ 11 struct { 12 A int 13 B int 14 }{A: 1, B: 2}: struct { 15 C string 16 D string 17 }{C: "c", D: "d"}, 18 }))) 19 os.Stdout.Write(assert.Must(Marshal(map[any]any{ 20 &Node{ 21 Kind: SequenceNode, 22 Content: []*Node{ 23 {Kind: ScalarNode, Tag: "!!str", Value: "1"}, 24 {Kind: ScalarNode, Tag: "!!str", Value: "2"}, 25 }, 26 }: struct { 27 C string 28 D string 29 }{C: "c", D: "d"}, 30 }))) 31 }