File

tests/test_util_jid.lua @ 239:6f4e9911c7d1

Fix jid.split test function
author Matthew Wild <mwild1@gmail.com>
date Sun, 09 Nov 2008 23:58:19 +0000
parent 28:4a238233f278
child 240:c48dbfa6b1a6
line wrap: on
line source


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