summaryrefslogtreecommitdiff
path: root/xmpp/jid_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp/jid_test.go')
-rw-r--r--xmpp/jid_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/xmpp/jid_test.go b/xmpp/jid_test.go
new file mode 100644
index 0000000..b900b9c
--- /dev/null
+++ b/xmpp/jid_test.go
@@ -0,0 +1,21 @@
+package xmpp
+
+import (
+ "testing"
+)
+
+func TestDomainpart(t *testing.T) {
+ var data = map[string]string{
+ "user@example.org/ressource": "example.org",
+ "example.org/ressource": "example.org",
+ "user@example.org": "example.org",
+ "example.org": "example.org",
+ "test.eu": "test.eu",
+ }
+
+ for k, v := range(data) {
+ if domainpart(k) != v {
+ t.Fatalf("Domain part of JID '%s' is not '%s'!", k, v)
+ }
+ }
+}