aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-03-17 19:50:22 +0100
committerKim Alvefur <zash@zash.se>2018-03-17 19:50:22 +0100
commitd1d9e835d3af080dffe2fd60ba55cd4c8d24f0d8 (patch)
treefecce7dea7b0bd63cff950e024dda2c40625c0c9 /spec
parent57563efe85db92b8daa7ec928fc466afffe11bd8 (diff)
downloadprosody-d1d9e835d3af080dffe2fd60ba55cd4c8d24f0d8.tar.gz
prosody-d1d9e835d3af080dffe2fd60ba55cd4c8d24f0d8.zip
util.stanza: Test coverage of is_stanza()
Diffstat (limited to 'spec')
-rw-r--r--spec/util_stanza_spec.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/util_stanza_spec.lua b/spec/util_stanza_spec.lua
index ea3ef4c9..f7759385 100644
--- a/spec/util_stanza_spec.lua
+++ b/spec/util_stanza_spec.lua
@@ -198,4 +198,20 @@ describe("util.stanza", function()
end);
end);
end);
+
+ describe("#is_stanza", function ()
+ -- is_stanza(any) -> boolean
+ it("identifies stanzas as stanzas", function ()
+ assert.truthy(st.is_stanza(st.stanza("x")));
+ end);
+ it("identifies strings as not stanzas", function ()
+ assert.falsy(st.is_stanza(""));
+ end);
+ it("identifies numbers as not stanzas", function ()
+ assert.falsy(st.is_stanza(1));
+ end);
+ it("identifies tables as not stanzas", function ()
+ assert.falsy(st.is_stanza({}));
+ end);
+ end);
end);