package stanza_test import ( "encoding/xml" "gosrc.io/xmpp/stanza" "testing" ) func TestMarshalCommands(t *testing.T) { input := "Available Services" + "" + "httpd" + "offoff" + "onon" + "postgresql" + "offoff" + "onon" + "jabberd" + "offoff" + "onon" 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()) } }