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.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/xmpp/jid_test.go b/xmpp/jid_test.go
index b900b9c..6f8b9fd 100644
--- a/xmpp/jid_test.go
+++ b/xmpp/jid_test.go
@@ -19,3 +19,20 @@ func TestDomainpart(t *testing.T) {
}
}
}
+
+func TestUsername(t *testing.T) {
+ var data = map[string]string{
+ "user@example.org/ressource": "user",
+ "example.org/ressource": "",
+ "user@example.org": "user",
+ "df%§df?LÖ@example.org": "df%§df?LÖ",
+ "example.org": "",
+ "test.eu": "",
+ }
+
+ for k, v := range(data) {
+ if username(k) != v {
+ t.Fatalf("Username of JID '%s' is not '%s'!", k, v)
+ }
+ }
+}