From 6c8d196c989a2963c9217da4ce365477e1b70cf6 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 17 Mar 2018 19:50:22 +0100 Subject: util.stanza: Test coverage of is_stanza() --- spec/util_stanza_spec.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'spec') 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); -- cgit v1.2.3