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

Function TestEncodeAttribute

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

Source from the content-addressed store, hash-verified

39}
40
41func TestEncodeAttribute(t *testing.T) {
42 b := bytes.NewBuffer(nil)
43 encoder := xml.NewEncoder(b)
44
45 func() {
46 r := xml.StartElement{
47 Name: xml.Name{Local: "payload", Space: "baz"},
48 Attr: []xml.Attr{
49 xml.NewAttribute("attrkey", "value"),
50 },
51 }
52
53 obj := encoder.RootElement(r)
54 obj.String("")
55 }()
56
57 expect := `<baz:payload attrkey="value"></baz:payload>`
58
59 verify(t, encoder, []byte(expect))
60}
61
62func TestEncodeNamespace(t *testing.T) {
63 b := bytes.NewBuffer(nil)

Callers

nothing calls this directly

Calls 5

RootElementMethod · 0.95
NewEncoderFunction · 0.92
NewAttributeFunction · 0.92
verifyFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected