Comparison

spec/core_storagemanager_spec.lua @ 10836:93019f3edd68

spec/storage: Reset build context of test stanza make comparisons easier While building a stanza there's a .last_add field keeping track of where in the XML tree tags are being added. This field does not survive a roundtrip through preserialize / deserialize. :reset() removes this, which simplifes comparisons after such a roundtrip.
author Kim Alvefur <zash@zash.se>
date Mon, 11 May 2020 21:41:02 +0200
parent 10680:19692fc5c106
child 10837:f23363380599
comparison
equal deleted inserted replaced
10835:e402f808de50 10836:93019f3edd68
204 archive = assert(sm.open(test_host, "test-archive", "archive")); 204 archive = assert(sm.open(test_host, "test-archive", "archive"));
205 end); 205 end);
206 206
207 local test_stanza = st.stanza("test", { xmlns = "urn:example:foo" }) 207 local test_stanza = st.stanza("test", { xmlns = "urn:example:foo" })
208 :tag("foo"):up() 208 :tag("foo"):up()
209 :tag("foo"):up(); 209 :tag("foo"):up()
210 :reset();
210 local test_time = 1539204123; 211 local test_time = 1539204123;
211 212
212 local test_data = { 213 local test_data = {
213 { nil, test_stanza, test_time, "contact@example.com" }; 214 { nil, test_stanza, test_time, "contact@example.com" };
214 { nil, test_stanza, test_time+1, "contact2@example.com" }; 215 { nil, test_stanza, test_time+1, "contact2@example.com" };