Software /
code /
prosody
Changeset
8621:e3e9479d526e
util.stanza: Test coverage of is_stanza()
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 17 Mar 2018 19:50:22 +0100 |
parents | 8620:84b73949fc30 |
children | 8622:92fee8a6c988 |
files | spec/util_stanza_spec.lua |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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);