Diff

tests/test_util_jid.lua @ 28:4a238233f278

Adding initial unit testing scripts
author Matthew Wild <mwild1@gmail.com>
date Sat, 27 Sep 2008 19:18:05 +0100
child 239:6f4e9911c7d1
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test_util_jid.lua	Sat Sep 27 19:18:05 2008 +0100
@@ -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