aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_util_jid.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-09-27 19:18:05 +0100
committerMatthew Wild <mwild1@gmail.com>2008-09-27 19:18:05 +0100
commiteabe25e8a4de6a2238559330909401e5be31998d (patch)
tree51f8847a829719e97badd60394fdcc0669ed69ba /tests/test_util_jid.lua
parent58d1a65408ee32d590071c2ced7260b5592b5d3c (diff)
downloadprosody-eabe25e8a4de6a2238559330909401e5be31998d.tar.gz
prosody-eabe25e8a4de6a2238559330909401e5be31998d.zip
Adding initial unit testing scripts
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