Diff

tests/test_util_jid.lua @ 2281:27441b099984

Merge with tip.
author Tobias Markmann <tm@ayena.de>
date Sun, 29 Nov 2009 21:33:37 +0100
parent 2247:f62af2a9974e
child 2923:b7049746bd29
line wrap: on
line diff
--- a/tests/test_util_jid.lua	Sun Nov 29 21:32:39 2009 +0100
+++ b/tests/test_util_jid.lua	Sun Nov 29 21:33:37 2009 +0100
@@ -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 @@
 	assert_equal(bare("user@@host/resource"), nil, "invalid JID is nil");
 	assert_equal(bare("user@host/"), nil, "invalid JID is nil");
 end
+