Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (20 sloc) 655 Bytes
package xmpp
import "testing"
func TestBadXmppMessage(t *testing.T) {
should(t, "create a nil message", func() bool {
return NewMessage("<message>no good info</message>") == nil
})
}
func TestXmppMessage(t *testing.T) {
msg := NewMessage("<message type=\"special\" from=\"me\" to=\"you\"><body>Hello world</body></message>")
should(t, "parse 'type'", func() bool {
return msg.Type() == "special"
})
should(t, "parse 'from'", func() bool {
return msg.From() == "me"
})
should(t, "parse 'to'", func() bool {
return msg.To() == "you"
})
should(t, "parse body", func() bool { return msg.Body() == "Hello world" })
}