Mercurial > prosody-hg
comparison spec/util_serialization_spec.lua @ 9566:dad29508d0f2
util.serialization: Test rejection of multiple references to same table
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 27 Oct 2018 12:40:47 +0200 |
| parents | c667887d78ad |
| children | dbfa286cfa88 |
comparison
equal
deleted
inserted
replaced
| 9565:9a1e2f5f674f | 9566:dad29508d0f2 |
|---|---|
| 22 it("rejects cycles", function () | 22 it("rejects cycles", function () |
| 23 assert.has_error(function () | 23 assert.has_error(function () |
| 24 local t = {} | 24 local t = {} |
| 25 t[t] = { t }; | 25 t[t] = { t }; |
| 26 serialization.serialize(t) | 26 serialization.serialize(t) |
| 27 end); | |
| 28 end); | |
| 29 | |
| 30 it("rejects multiple references to same table", function () | |
| 31 assert.has_error(function () | |
| 32 local t1 = {}; | |
| 33 local t2 = { t1, t1 }; | |
| 34 serialization.serialize(t2); | |
| 27 end); | 35 end); |
| 28 end); | 36 end); |
| 29 | 37 |
| 30 it("roundtrips", function () | 38 it("roundtrips", function () |
| 31 local function test(data) | 39 local function test(data) |
