From a83cf53a220529936f62cae63d5e55677eb145b3 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 17 Nov 2018 15:26:11 +0100 Subject: util.stanza: Validate input to clone() (with brief tests) --- spec/util_stanza_spec.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'spec/util_stanza_spec.lua') 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); -- cgit v1.2.3