Software / code / prosody
Annotate
tests/test_util_jid.lua @ 357:17bcecb06420
Use a stanza for c2s stream features instead of an array of strings. Removes a FIXME.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 20 Nov 2008 01:33:25 +0000 |
| parent | 240:c48dbfa6b1a6 |
| child | 366:5691edc7dd63 |
| 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) |
|
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 | 13 test(nil, nil, nil , nil ); |
|
28
4a238233f278
Adding initial unit testing scripts
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 end |