Software /
code /
prosody
Annotate
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 |
rev | line source |
---|---|
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) |
4a238233f278
Adding initial unit testing scripts
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 function test(jid, node, server, resource) |
4a238233f278
Adding initial unit testing scripts
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 local rnode, rserver, rresource = split(jid); |
239 | 5 assert_equal(node, rnode, "split("..tostring(jid)..") failed"); |
6 assert_equal(server, rserver, "split("..tostring(jid)..") failed"); | |
7 assert_equal(resource, rresource, "split("..tostring(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 | 13 test(nil, nil, nil , nil ); |
28
4a238233f278
Adding initial unit testing scripts
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 end |