Software /
code /
prosody
Comparison
tests/test_util_stanza.lua @ 688:5f77bbc1f04a
Automated merge with http://waqas.ath.cx:8000/
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 09 Jan 2009 19:19:06 +0000 |
parent | 682:dedd19e9d4b3 |
child | 1522:569d58d21612 |
comparison
equal
deleted
inserted
replaced
687:a92d647624a1 | 688:5f77bbc1f04a |
---|---|
1 | |
2 function preserialize(preserialize, st) | |
3 local stanza = st.stanza("message", { a = "a" }); | |
4 local stanza2 = preserialize(stanza); | |
5 assert_is(stanza2 and stanza.name, "preserialize returns a stanza"); | |
6 assert_is_not(stanza2.tags, "Preserialized stanza has no tag list"); | |
7 assert_is_not(stanza2.last_add, "Preserialized stanza has no last_add marker"); | |
8 assert_is_not(getmetatable(stanza2), "Preserialized stanza has no metatable"); | |
9 end | |
10 | |
11 function deserialize(deserialize, st) | |
12 local stanza = st.stanza("message", { a = "a" }); | |
13 | |
14 local stanza2 = deserialize(st.preserialize(stanza)); | |
15 assert_is(stanza2 and stanza.name, "deserialize returns a stanza"); | |
16 assert_is(stanza2.last_add, "Deserialized stanza is missing last_add for adding child tags"); | |
17 assert_table(stanza2.attr, "Deserialized stanza has attributes"); | |
18 assert_equal(stanza2.attr.a, "a", "Deserialized stanza retains attributes"); | |
19 assert_table(getmetatable(stanza2), "Deserialized stanza has metatable"); | |
20 end |