MCPcopy Create free account
hub / github.com/aws/smithy-go / TestEncodeListFlatten

Function TestEncodeListFlatten

encoding/xml/encoder_test.go:341–360  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

339}
340
341func TestEncodeListFlatten(t *testing.T) {
342 b := bytes.NewBuffer(nil)
343 encoder := xml.NewEncoder(b)
344
345 func() {
346 r := encoder.RootElement(root)
347 defer r.Close()
348
349 // Object key `liststr`
350 liststr := xml.StartElement{Name: xml.Name{Local: "liststr"}}
351 m := r.FlattenedElement(liststr)
352
353 a := m.Array()
354 a.Member().String("abc")
355 a.Member().Integer(123)
356 }()
357
358 ex := []byte(`<root><liststr>abc</liststr><liststr>123</liststr></root>`)
359 verify(t, encoder, ex)
360}
361
362func TestEncodeListNamed(t *testing.T) {
363 b := bytes.NewBuffer(nil)

Callers

nothing calls this directly

Calls 9

RootElementMethod · 0.95
NewEncoderFunction · 0.92
verifyFunction · 0.85
FlattenedElementMethod · 0.80
MemberMethod · 0.80
StringMethod · 0.65
CloseMethod · 0.45
ArrayMethod · 0.45
IntegerMethod · 0.45

Tested by

no test coverage detected