aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_util_jid.lua
blob: 58fadbb78017a967cbf15b3f8e78b4a850e6d184 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14

function split(split)
	function test(jid, node, server, resource)
		local rnode, rserver, rresource = split(jid);
		assert_equal(node, rnode, "split("..tostring(jid)..") failed");
		assert_equal(server, rserver, "split("..tostring(jid)..") failed");
		assert_equal(resource, rresource, "split("..tostring(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"	);
	test(nil,			nil,	nil	, nil		);
end