Software /
code /
prosody
Changeset
2247:f62af2a9974e
tests: Add tests for util.jid.join()
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 27 Nov 2009 17:41:52 +0000 |
parents | 2246:eb047fe305aa |
children | 2248:37344b18b551 |
files | tests/test_util_jid.lua |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test_util_jid.lua Fri Nov 27 17:39:17 2009 +0000 +++ b/tests/test_util_jid.lua Fri Nov 27 17:41:52 2009 +0000 @@ -6,6 +6,16 @@ -- COPYING file in the source package for more information. -- +function join(join) + assert_equal(join("a", "b", "c"), "a@b/c", "builds full JID"); + assert_equal(join("a", "b", nil), "a@b", "builds bare JID"); + assert_equal(join(nil, "b", "c"), "b/c", "builds full host JID"); + assert_equal(join(nil, "b", nil), "b", "builds bare host JID"); + assert_equal(join(nil, nil, nil), nil, "invalid JID is nil"); + assert_equal(join("a", nil, nil), nil, "invalid JID is nil"); + assert_equal(join(nil, nil, "c"), nil, "invalid JID is nil"); + assert_equal(join("a", nil, "c"), nil, "invalid JID is nil"); +end function split(split) @@ -43,3 +53,4 @@ assert_equal(bare("user@@host/resource"), nil, "invalid JID is nil"); assert_equal(bare("user@host/"), nil, "invalid JID is nil"); end +