(t *testing.T)
| 417 | |
| 418 | // |
| 419 | func TestEncodeListFlattenShape(t *testing.T) { |
| 420 | b := bytes.NewBuffer(nil) |
| 421 | encoder := xml.NewEncoder(b) |
| 422 | |
| 423 | func() { |
| 424 | r := encoder.RootElement(root) |
| 425 | defer r.Close() |
| 426 | |
| 427 | // Object key `liststr` |
| 428 | liststr := xml.StartElement{Name: xml.Name{Local: "liststr"}} |
| 429 | |
| 430 | m := r.FlattenedElement(liststr) |
| 431 | |
| 432 | a := m.Array() |
| 433 | value := xml.StartElement{Name: xml.Name{Local: "value"}} |
| 434 | |
| 435 | m1 := a.Member() |
| 436 | m1.MemberElement(value).String("abc") |
| 437 | m1.Close() |
| 438 | |
| 439 | m2 := a.Member() |
| 440 | m2.MemberElement(value).Integer(123) |
| 441 | m2.Close() |
| 442 | }() |
| 443 | |
| 444 | ex := []byte(`<root><liststr><value>abc</value></liststr><liststr><value>123</value></liststr></root>`) |
| 445 | verify(t, encoder, ex) |
| 446 | } |
| 447 | |
| 448 | // |
| 449 | func TestEncodeListNamedShape(t *testing.T) { |
nothing calls this directly
no test coverage detected