package stanza_test import ( "encoding/xml" "gosrc.io/xmpp/stanza" "testing" ) func TestMarshalCommands(t *testing.T) { input := "Available Servi" + "ces<" + "field xmlns=\"jabber:x:data\" var=\"service\">httpdoffoffononpostgresqloffoffon" + "onjabberdoffoffonon" var c stanza.Command err := xml.Unmarshal([]byte(input), &c) if err != nil { t.Fatalf("failed to unmarshal initial input") } data, err := xml.Marshal(c) if err != nil { t.Fatalf("failed to marshal unmarshalled input") } if err := compareMarshal(input, string(data)); err != nil { t.Fatalf(err.Error()) } }