tests/test_util_jid.lua

Thu, 13 Nov 2008 03:56:22 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 13 Nov 2008 03:56:22 +0000
changeset 244
0e3bda34f958
parent 240
c48dbfa6b1a6
child 366
5691edc7dd63
permissions
-rw-r--r--

Missed importing a function in last commit

28
4a238233f278 Adding initial unit testing scripts
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1
4a238233f278 Adding initial unit testing scripts
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 function split(split)
240
c48dbfa6b1a6 Renamed some of the variables in jid.split test to make it clearer
Matthew Wild <mwild1@gmail.com>
parents: 239
diff changeset
3 function test(input_jid, expected_node, expected_server, expected_resource)
c48dbfa6b1a6 Renamed some of the variables in jid.split test to make it clearer
Matthew Wild <mwild1@gmail.com>
parents: 239
diff changeset
4 local rnode, rserver, rresource = split(input_jid);
c48dbfa6b1a6 Renamed some of the variables in jid.split test to make it clearer
Matthew Wild <mwild1@gmail.com>
parents: 239
diff changeset
5 assert_equal(expected_node, rnode, "split("..tostring(input_jid)..") failed");
c48dbfa6b1a6 Renamed some of the variables in jid.split test to make it clearer
Matthew Wild <mwild1@gmail.com>
parents: 239
diff changeset
6 assert_equal(expected_server, rserver, "split("..tostring(input_jid)..") failed");
c48dbfa6b1a6 Renamed some of the variables in jid.split test to make it clearer
Matthew Wild <mwild1@gmail.com>
parents: 239
diff changeset
7 assert_equal(expected_resource, rresource, "split("..tostring(input_jid)..") failed");
28
4a238233f278 Adding initial unit testing scripts
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 end
4a238233f278 Adding initial unit testing scripts
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 test("node@server", "node", "server", nil );
4a238233f278 Adding initial unit testing scripts
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 test("node@server/resource", "node", "server", "resource" );
4a238233f278 Adding initial unit testing scripts
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 test("server", nil, "server", nil );
4a238233f278 Adding initial unit testing scripts
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 test("server/resource", nil, "server", "resource" );
239
6f4e9911c7d1 Fix jid.split test function
Matthew Wild <mwild1@gmail.com>
parents: 28
diff changeset
13 test(nil, nil, nil , nil );
28
4a238233f278 Adding initial unit testing scripts
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 end

mercurial