| 21 | } |
| 22 | |
| 23 | func TestWrappedArrayWithCustomName(t *testing.T) { |
| 24 | buffer := bytes.NewBuffer(nil) |
| 25 | scratch := make([]byte, 64) |
| 26 | |
| 27 | root := StartElement{Name: Name{Local: "array"}} |
| 28 | item := StartElement{Name: Name{Local: "item"}} |
| 29 | a := newArray(buffer, &scratch, item, root, false) |
| 30 | a.Member().String("bar") |
| 31 | a.Member().String("baz") |
| 32 | |
| 33 | e := []byte(`<item>bar</item><item>baz</item>`) |
| 34 | if a := buffer.Bytes(); bytes.Compare(e, a) != 0 { |
| 35 | t.Errorf("expected %+q, but got %+q", e, a) |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | func TestFlattenedArray(t *testing.T) { |
| 40 | buffer := bytes.NewBuffer(nil) |