Software /
code /
prosody
Comparison
spec/util_stanza_spec.lua @ 8621:e3e9479d526e
util.stanza: Test coverage of is_stanza()
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 17 Mar 2018 19:50:22 +0100 |
parent | 8599:62bfc85a53c8 |
child | 8626:20532f191f8d |
comparison
equal
deleted
inserted
replaced
8620:84b73949fc30 | 8621:e3e9479d526e |
---|---|
196 assert.has_error(function () | 196 assert.has_error(function () |
197 st.stanza("tag"):text("hello "..string.char(0xF4, 0x90, 0x80, 0x80).." world"); | 197 st.stanza("tag"):text("hello "..string.char(0xF4, 0x90, 0x80, 0x80).." world"); |
198 end); | 198 end); |
199 end); | 199 end); |
200 end); | 200 end); |
201 | |
202 describe("#is_stanza", function () | |
203 -- is_stanza(any) -> boolean | |
204 it("identifies stanzas as stanzas", function () | |
205 assert.truthy(st.is_stanza(st.stanza("x"))); | |
206 end); | |
207 it("identifies strings as not stanzas", function () | |
208 assert.falsy(st.is_stanza("")); | |
209 end); | |
210 it("identifies numbers as not stanzas", function () | |
211 assert.falsy(st.is_stanza(1)); | |
212 end); | |
213 it("identifies tables as not stanzas", function () | |
214 assert.falsy(st.is_stanza({})); | |
215 end); | |
216 end); | |
201 end); | 217 end); |