xmpp/structs_test.go
changeset 147 d7679d991b17
parent 142 0ff033eed887
child 163 3f891f7fe817
equal deleted inserted replaced
146:aa9a0ae8f875 147:d7679d991b17
   116 
   116 
   117 func TestUnmarshalMessage(t *testing.T) {
   117 func TestUnmarshalMessage(t *testing.T) {
   118 	str := `<message to="a@b.c"><body>foo!</body></message>`
   118 	str := `<message to="a@b.c"><body>foo!</body></message>`
   119 	r := strings.NewReader(str)
   119 	r := strings.NewReader(str)
   120 	ch := make(chan interface{})
   120 	ch := make(chan interface{})
   121 	go readXml(r, ch, make(map[xml.Name]reflect.Type))
   121 	go recvXml(r, ch, make(map[xml.Name]reflect.Type))
   122 	obs := <-ch
   122 	obs := <-ch
   123 	exp := &Message{XMLName: xml.Name{Local: "message", Space: "jabber:client"},
   123 	exp := &Message{XMLName: xml.Name{Local: "message", Space: "jabber:client"},
   124 		Header: Header{To: "a@b.c", Innerxml: "<body>foo!</body>"},
   124 		Header: Header{To: "a@b.c", Innerxml: "<body>foo!</body>"},
   125 		Body: &Generic{XMLName: xml.Name{Local: "body", Space: "jabber:client"},
   125 		Body: &Generic{XMLName: xml.Name{Local: "body", Space: "jabber:client"},
   126 			Chardata: "foo!"}}
   126 			Chardata: "foo!"}}