aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_util_jid.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_util_jid.lua')
-rw-r--r--tests/test_util_jid.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_util_jid.lua b/tests/test_util_jid.lua
new file mode 100644
index 00000000..3be0bfa1
--- /dev/null
+++ b/tests/test_util_jid.lua
@@ -0,0 +1,13 @@
+
+function split(split)
+ function test(jid, node, server, resource)
+ local rnode, rserver, rresource = split(jid);
+ assert_equal(node, rnode, "split("..jid..") failed");
+ assert_equal(server, rserver, "split("..jid..") failed");
+ assert_equal(resource, rresource, "split("..jid..") failed");
+ end
+ test("node@server", "node", "server", nil );
+ test("node@server/resource", "node", "server", "resource" );
+ test("server", nil, "server", nil );
+ test("server/resource", nil, "server", "resource" );
+end