diff options
author | Kim Alvefur <zash@zash.se> | 2018-06-02 19:57:46 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-06-02 19:57:46 +0200 |
commit | 7bc9f73c736d558386cfbce9d57a7dddd0b5479b (patch) | |
tree | 810fd6136e2a41a3b4316066eaccace728e7e185 /spec | |
parent | dd0d9009e8491223396cde8e7bccfc9aa168fa0d (diff) | |
download | prosody-7bc9f73c736d558386cfbce9d57a7dddd0b5479b.tar.gz prosody-7bc9f73c736d558386cfbce9d57a7dddd0b5479b.zip |
util.dataforms: Add a simple function for identifying form types
This is meant to allow identifying forms without parsing them
completely.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util_dataforms_spec.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/util_dataforms_spec.lua b/spec/util_dataforms_spec.lua index 4b85444f..56751041 100644 --- a/spec/util_dataforms_spec.lua +++ b/spec/util_dataforms_spec.lua @@ -301,5 +301,14 @@ describe("util.dataforms", function () assert.equal("text-single-value", f:get_child_text("value")); end); + describe("get_type()", function () + it("identifes dataforms", function () + assert.equal(nil, dataforms.get_type(nil)); + assert.equal(nil, dataforms.get_type("")); + assert.equal(nil, dataforms.get_type({})); + assert.equal(nil, dataforms.get_type(st.stanza("no-a-form"))); + assert.equal("xmpp:prosody.im/spec/util.dataforms#1", dataforms.get_type(xform)); + end); + end); end); |