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) } } } 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) } } }