Software /
code /
prosody
Comparison
tests/test_util_jid.lua @ 3479:f68198c2f68f
tests/test_util_jid.lua: Add more tests for JID splitting
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 31 Aug 2010 00:28:49 +0100 |
parent | 3451:6402a9defcdc |
child | 5776:bd0ff8ae98a8 |
comparison
equal
deleted
inserted
replaced
3478:4621c92d2368 | 3479:f68198c2f68f |
---|---|
26 assert_equal(expected_resource, rresource, "split("..tostring(input_jid)..") failed"); | 26 assert_equal(expected_resource, rresource, "split("..tostring(input_jid)..") failed"); |
27 end | 27 end |
28 | 28 |
29 -- Valid JIDs | 29 -- Valid JIDs |
30 test("node@server", "node", "server", nil ); | 30 test("node@server", "node", "server", nil ); |
31 test("node@server/resource", "node", "server", "resource" ); | 31 test("node@server/resource", "node", "server", "resource" ); |
32 test("server", nil, "server", nil ); | 32 test("server", nil, "server", nil ); |
33 test("server/resource", nil, "server", "resource" ); | 33 test("server/resource", nil, "server", "resource" ); |
34 test("server/resource@foo", nil, "server", "resource@foo" ); | |
35 test("server/resource@foo/bar", nil, "server", "resource@foo/bar"); | |
34 | 36 |
35 -- Always invalid JIDs | 37 -- Always invalid JIDs |
36 test(nil, nil, nil, nil); | 38 test(nil, nil, nil, nil); |
37 test("node@/server", nil, nil, nil); | 39 test("node@/server", nil, nil, nil); |
38 test("@server", nil, nil, nil); | 40 test("@server", nil, nil, nil); |
39 test("@server/resource", nil, nil, nil); | 41 test("@server/resource", nil, nil, nil); |
42 test("@/resource", nil, nil, nil); | |
40 end | 43 end |
41 | 44 |
42 function bare(bare) | 45 function bare(bare) |
43 assert_equal(bare("user@host"), "user@host", "bare JID remains bare"); | 46 assert_equal(bare("user@host"), "user@host", "bare JID remains bare"); |
44 assert_equal(bare("host"), "host", "Host JID remains host"); | 47 assert_equal(bare("host"), "host", "Host JID remains host"); |