aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-11-27 17:41:52 +0000
committerMatthew Wild <mwild1@gmail.com>2009-11-27 17:41:52 +0000
commit8cfd5950a3a3af7be64ca310a629a147dd6b4017 (patch)
tree0e0f25822bf852faed304f86f74bdd07380e4bb1 /tests
parent822161982a48e01537d7075226134b5e16a4f5a7 (diff)
downloadprosody-8cfd5950a3a3af7be64ca310a629a147dd6b4017.tar.gz
prosody-8cfd5950a3a3af7be64ca310a629a147dd6b4017.zip
tests: Add tests for util.jid.join()
Diffstat (limited to 'tests')
-rw-r--r--tests/test_util_jid.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_util_jid.lua b/tests/test_util_jid.lua
index fe6ec74e..f579e597 100644
--- a/tests/test_util_jid.lua
+++ b/tests/test_util_jid.lua
@@ -6,6 +6,16 @@
-- COPYING file in the source package for more information.
--
+function join(join)
+ assert_equal(join("a", "b", "c"), "a@b/c", "builds full JID");
+ assert_equal(join("a", "b", nil), "a@b", "builds bare JID");
+ assert_equal(join(nil, "b", "c"), "b/c", "builds full host JID");
+ assert_equal(join(nil, "b", nil), "b", "builds bare host JID");
+ assert_equal(join(nil, nil, nil), nil, "invalid JID is nil");
+ assert_equal(join("a", nil, nil), nil, "invalid JID is nil");
+ assert_equal(join(nil, nil, "c"), nil, "invalid JID is nil");
+ assert_equal(join("a", nil, "c"), nil, "invalid JID is nil");
+end
function split(split)
@@ -43,3 +53,4 @@ function bare(bare)
assert_equal(bare("user@@host/resource"), nil, "invalid JID is nil");
assert_equal(bare("user@host/"), nil, "invalid JID is nil");
end
+