util.stanza: Test coverage of is_stanza()
authorKim Alvefur <zash@zash.se>
Sat, 17 Mar 2018 19:50:22 +0100
changeset 8624 e3e9479d526e
parent 8623 84b73949fc30
child 8625 92fee8a6c988
util.stanza: Test coverage of is_stanza()
spec/util_stanza_spec.lua
--- a/spec/util_stanza_spec.lua	Sat Mar 17 19:47:48 2018 +0100
+++ b/spec/util_stanza_spec.lua	Sat Mar 17 19:50:22 2018 +0100
@@ -198,4 +198,20 @@
 			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);