xmpp/structs_test.go
changeset 163 3f891f7fe817
parent 147 d7679d991b17
child 172 36a42bc073f0
equal deleted inserted replaced
162:7b5586a5e109 163:3f891f7fe817
   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 recvXml(r, ch, make(map[xml.Name]reflect.Type))
   121 	cl := &Client{}
       
   122 	go cl.recvXml(r, ch, make(map[xml.Name]reflect.Type))
   122 	obs := <-ch
   123 	obs := <-ch
   123 	exp := &Message{XMLName: xml.Name{Local: "message", Space: "jabber:client"},
   124 	exp := &Message{XMLName: xml.Name{Local: "message", Space: "jabber:client"},
   124 		Header: Header{To: "a@b.c", Innerxml: "<body>foo!</body>"},
   125 		Header: Header{To: "a@b.c", Innerxml: "<body>foo!</body>"},
   125 		Body: &Generic{XMLName: xml.Name{Local: "body", Space: "jabber:client"},
   126 		Body: &Generic{XMLName: xml.Name{Local: "body", Space: "jabber:client"},
   126 			Chardata: "foo!"}}
   127 			Chardata: "foo!"}}