From c392810d29e6b1f42c9c91892b3581e689e6f7dc Mon Sep 17 00:00:00 2001 From: Mickael Remond Date: Wed, 6 Jan 2016 17:59:44 +0100 Subject: [PATCH] Adding basic tests --- .travis.yml | 5 +++++ xmpp/jid_test.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 .travis.yml create mode 100644 xmpp/jid_test.go diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..a24aede --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: go + +go: + - 1.5 + - tip \ No newline at end of file diff --git a/xmpp/jid_test.go b/xmpp/jid_test.go new file mode 100644 index 0000000..332206e --- /dev/null +++ b/xmpp/jid_test.go @@ -0,0 +1,28 @@ +package xmpp + +import ( + "testing" +) + +func TestBareJid(t *testing.T) { + var jid *Jid + var err error + + bareJid := "test@domain.com" + + if jid, err = NewJid(bareJid); err != nil { + t.Error("could not parse bare jid") + } + + if jid.username != "test" { + t.Error("incorrect bare jid username") + } + + if jid.domain != "domain.com" { + t.Error("incorrect bare jid domain") + } + + if jid.resource != "" { + t.Error("bare jid resource should be empty") + } +}