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
commit6c8d196c989a2963c9217da4ce365477e1b70cf6 (patch)
treefecce7dea7b0bd63cff950e024dda2c40625c0c9 /spec
parentf45bf9451883e0b988740ff160c2e2df5cd44db4 (diff)
downloadprosody-6c8d196c989a2963c9217da4ce365477e1b70cf6.tar.gz
prosody-6c8d196c989a2963c9217da4ce365477e1b70cf6.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);