From 8cb0f81d770f01ed06adb71561463418c7fec82a Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 25 May 2023 18:43:12 +0200 Subject: Implement first unit test and integrate into build --- xmpp/jid_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 xmpp/jid_test.go (limited to 'xmpp/jid_test.go') 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) + } + } +} -- cgit v1.2.3-70-g09d2