aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_stanza_spec.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-11-17 15:26:11 +0100
committerKim Alvefur <zash@zash.se>2018-11-17 15:26:11 +0100
commit79d81ba192dc00dbea256eedb3d868c2d5e605a8 (patch)
tree2ee472e15e4b5e42a04ffa8b5afa7632065afbfd /spec/util_stanza_spec.lua
parentc29fb458fe068abf3c8ba0a021d01fb33752e9a0 (diff)
downloadprosody-79d81ba192dc00dbea256eedb3d868c2d5e605a8.tar.gz
prosody-79d81ba192dc00dbea256eedb3d868c2d5e605a8.zip
util.stanza: Validate input to clone() (with brief tests)
Diffstat (limited to 'spec/util_stanza_spec.lua')
-rw-r--r--spec/util_stanza_spec.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/util_stanza_spec.lua b/spec/util_stanza_spec.lua
index 7eaadfe6..7fe836c7 100644
--- a/spec/util_stanza_spec.lua
+++ b/spec/util_stanza_spec.lua
@@ -346,4 +346,18 @@ describe("util.stanza", function()
end, "Invalid stanza");
end);
end);
+
+ describe("#clone", function ()
+ it("works", function ()
+ local s = st.message({type="chat"}, "Hello"):reset();
+ local c = st.clone(s);
+ assert.same(s, c);
+ end);
+
+ it("works", function ()
+ assert.has_error(function ()
+ st.clone("this is not a stanza");
+ end);
+ end);
+ end);
end);