# HG changeset patch # User Chris Jones # Date 1325104125 25200 # Node ID fff79efe06f6b0affa207939455ecdd555a3f190 # Parent b5de44679389f4dbedcbd5d77f44055329cce022 Removed definedCondition in favor of Generic. diff -r b5de44679389 -r fff79efe06f6 structs.go --- a/structs.go Wed Dec 28 13:24:08 2011 -0700 +++ b/structs.go Wed Dec 28 13:28:45 2011 -0700 @@ -43,18 +43,11 @@ // // BUG(cjyar) Can this be consolidated with Error? Hide it if not. type StreamError struct { - Any definedCondition + Any Generic Text *errText } var _ xml.Marshaler = &StreamError{} -// BUG(cjyar) Replace this with Generic. -type definedCondition struct { - // Must always be in namespace nsStreams - XMLName xml.Name - Chardata string `xml:"chardata"` -} - type errText struct { Lang string `xml:"attr"` Text string `xml:"chardata"` diff -r b5de44679389 -r fff79efe06f6 structs_test.go --- a/structs_test.go Wed Dec 28 13:24:08 2011 -0700 +++ b/structs_test.go Wed Dec 28 13:28:45 2011 -0700 @@ -69,13 +69,13 @@ func TestStreamErrorMarshal(t *testing.T) { name := xml.Name{Space: nsStreams, Local: "ack"} - e := &StreamError{Any: definedCondition{XMLName: name}} + e := &StreamError{Any: Generic{XMLName: name}} exp := ``; assertMarshal(t, exp, e) txt := errText{Lang: "pt", Text: "things happen"} - e = &StreamError{Any: definedCondition{XMLName: name}, Text: &txt} + e = &StreamError{Any: Generic{XMLName: name}, Text: &txt} exp = `things happen` diff -r b5de44679389 -r fff79efe06f6 xmpp_test.go --- a/xmpp_test.go Wed Dec 28 13:24:08 2011 -0700 +++ b/xmpp_test.go Wed Dec 28 13:28:45 2011 -0700 @@ -78,15 +78,15 @@ } func TestWriteError(t *testing.T) { - se := &StreamError{Any: definedCondition{XMLName: - xml.Name{Local: "blah"}}} + se := &StreamError{Any: Generic{XMLName: xml.Name{Local: + "blah"}}} str := testWrite(se) exp := `` assertEquals(t, exp, str) - se = &StreamError{Any: definedCondition{XMLName: - xml.Name{Space: nsStreams, Local: "foo"}}, - Text: &errText{Lang: "ru", Text: "Пошёл ты"}} + se = &StreamError{Any: Generic{XMLName: xml.Name{Space: + nsStreams, Local: "foo"}}, Text: + &errText{Lang: "ru", Text: "Пошёл ты"}} str = testWrite(se) exp = `