xmpp_test.go
changeset 24 fff79efe06f6
parent 22 d6b7b4cbf50d
child 31 1dc47df5c99f
equal deleted inserted replaced
23:b5de44679389 24:fff79efe06f6
    76 	wg.Wait()
    76 	wg.Wait()
    77 	return w.String()
    77 	return w.String()
    78 }
    78 }
    79 
    79 
    80 func TestWriteError(t *testing.T) {
    80 func TestWriteError(t *testing.T) {
    81 	se := &StreamError{Any: definedCondition{XMLName:
    81 	se := &StreamError{Any: Generic{XMLName: xml.Name{Local:
    82 			xml.Name{Local: "blah"}}}
    82 				"blah"}}}
    83 	str := testWrite(se)
    83 	str := testWrite(se)
    84 	exp := `<stream:error><blah></blah></stream:error>`
    84 	exp := `<stream:error><blah></blah></stream:error>`
    85 	assertEquals(t, exp, str)
    85 	assertEquals(t, exp, str)
    86 
    86 
    87 	se = &StreamError{Any: definedCondition{XMLName:
    87 	se = &StreamError{Any: Generic{XMLName: xml.Name{Space:
    88 			xml.Name{Space: nsStreams, Local: "foo"}},
    88 				nsStreams, Local: "foo"}}, Text:
    89 		Text: &errText{Lang: "ru", Text: "Пошёл ты"}}
    89 		&errText{Lang: "ru", Text: "Пошёл ты"}}
    90 	str = testWrite(se)
    90 	str = testWrite(se)
    91 	exp = `<stream:error><foo xmlns="` + nsStreams +
    91 	exp = `<stream:error><foo xmlns="` + nsStreams +
    92 		`"></foo><text xmlns="` + nsStreams +
    92 		`"></foo><text xmlns="` + nsStreams +
    93 		`" xml:lang="ru">Пошёл ты</text></stream:error>`
    93 		`" xml:lang="ru">Пошёл ты</text></stream:error>`
    94 	assertEquals(t, exp, str)
    94 	assertEquals(t, exp, str)