diff options
author | Anton Shestakov <av6@dwimlabs.net> | 2016-07-14 18:54:17 +0800 |
---|---|---|
committer | Anton Shestakov <av6@dwimlabs.net> | 2016-07-14 18:54:17 +0800 |
commit | 92ae03df962e92a696145c062067b9cc631b41c6 (patch) | |
tree | b487e3baf1198954413fc4bf512eff2d00dbfea2 /tests | |
parent | 1698a5f3cf7031c4c41dad811d8e3a1b60b569b3 (diff) | |
download | prosody-92ae03df962e92a696145c062067b9cc631b41c6.tar.gz prosody-92ae03df962e92a696145c062067b9cc631b41c6.zip |
test_util_stanza: wrap individual test blocks in do-end [luacheck]
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_util_stanza.lua | 122 |
1 files changed, 66 insertions, 56 deletions
diff --git a/tests/test_util_stanza.lua b/tests/test_util_stanza.lua index e5c96425..bc0ac64a 100644 --- a/tests/test_util_stanza.lua +++ b/tests/test_util_stanza.lua @@ -80,63 +80,73 @@ function presence(presence) end function reply(reply, _M) - -- Test stanza - local s = _M.stanza("s", { to = "touser", from = "fromuser", id = "123" }) - :tag("child1"); - -- Make reply stanza - local r = reply(s); - assert_equal(r.name, s.name); - assert_equal(r.id, s.id); - assert_equal(r.attr.to, s.attr.from); - assert_equal(r.attr.from, s.attr.to); - assert_equal(#r.tags, 0, "A reply should not include children of the original stanza"); - - -- Test stanza - local s = _M.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "get" }) - :tag("child1"); - -- Make reply stanza - local r = reply(s); - assert_equal(r.name, s.name); - assert_equal(r.id, s.id); - assert_equal(r.attr.to, s.attr.from); - assert_equal(r.attr.from, s.attr.to); - assert_equal(r.attr.type, "result"); - assert_equal(#r.tags, 0, "A reply should not include children of the original stanza"); - - -- Test stanza - local s = _M.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "set" }) - :tag("child1"); - -- Make reply stanza - local r = reply(s); - assert_equal(r.name, s.name); - assert_equal(r.id, s.id); - assert_equal(r.attr.to, s.attr.from); - assert_equal(r.attr.from, s.attr.to); - assert_equal(r.attr.type, "result"); - assert_equal(#r.tags, 0, "A reply should not include children of the original stanza"); + do + -- Test stanza + local s = _M.stanza("s", { to = "touser", from = "fromuser", id = "123" }) + :tag("child1"); + -- Make reply stanza + local r = reply(s); + assert_equal(r.name, s.name); + assert_equal(r.id, s.id); + assert_equal(r.attr.to, s.attr.from); + assert_equal(r.attr.from, s.attr.to); + assert_equal(#r.tags, 0, "A reply should not include children of the original stanza"); + end + + do + -- Test stanza + local s = _M.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "get" }) + :tag("child1"); + -- Make reply stanza + local r = reply(s); + assert_equal(r.name, s.name); + assert_equal(r.id, s.id); + assert_equal(r.attr.to, s.attr.from); + assert_equal(r.attr.from, s.attr.to); + assert_equal(r.attr.type, "result"); + assert_equal(#r.tags, 0, "A reply should not include children of the original stanza"); + end + + do + -- Test stanza + local s = _M.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "set" }) + :tag("child1"); + -- Make reply stanza + local r = reply(s); + assert_equal(r.name, s.name); + assert_equal(r.id, s.id); + assert_equal(r.attr.to, s.attr.from); + assert_equal(r.attr.from, s.attr.to); + assert_equal(r.attr.type, "result"); + assert_equal(#r.tags, 0, "A reply should not include children of the original stanza"); + end end function error_reply(error_reply, _M) - -- Test stanza - local s = _M.stanza("s", { to = "touser", from = "fromuser", id = "123" }) - :tag("child1"); - -- Make reply stanza - local r = error_reply(s); - assert_equal(r.name, s.name); - assert_equal(r.id, s.id); - assert_equal(r.attr.to, s.attr.from); - assert_equal(r.attr.from, s.attr.to); - assert_equal(#r.tags, 1); - - -- Test stanza - local s = _M.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "get" }) - :tag("child1"); - -- Make reply stanza - local r = error_reply(s); - assert_equal(r.name, s.name); - assert_equal(r.id, s.id); - assert_equal(r.attr.to, s.attr.from); - assert_equal(r.attr.from, s.attr.to); - assert_equal(r.attr.type, "error"); - assert_equal(#r.tags, 1); + do + -- Test stanza + local s = _M.stanza("s", { to = "touser", from = "fromuser", id = "123" }) + :tag("child1"); + -- Make reply stanza + local r = error_reply(s); + assert_equal(r.name, s.name); + assert_equal(r.id, s.id); + assert_equal(r.attr.to, s.attr.from); + assert_equal(r.attr.from, s.attr.to); + assert_equal(#r.tags, 1); + end + + do + -- Test stanza + local s = _M.stanza("iq", { to = "touser", from = "fromuser", id = "123", type = "get" }) + :tag("child1"); + -- Make reply stanza + local r = error_reply(s); + assert_equal(r.name, s.name); + assert_equal(r.id, s.id); + assert_equal(r.attr.to, s.attr.from); + assert_equal(r.attr.from, s.attr.to); + assert_equal(r.attr.type, "error"); + assert_equal(#r.tags, 1); + end end |