aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_serialization_spec.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-11 22:48:08 +0200
committerKim Alvefur <zash@zash.se>2018-10-11 22:48:08 +0200
commitd48f36ce3837a9744205b41684d75ac0b7110f91 (patch)
tree3a583a4166cda101a1dce5935cf7ac438198fc2a /spec/util_serialization_spec.lua
parentb7fd262a4c458336e99ed1942bfe190aa02b932c (diff)
downloadprosody-d48f36ce3837a9744205b41684d75ac0b7110f91.tar.gz
prosody-d48f36ce3837a9744205b41684d75ac0b7110f91.zip
util.serialization: Test that it rejects tables wit cycles
Diffstat (limited to 'spec/util_serialization_spec.lua')
-rw-r--r--spec/util_serialization_spec.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/util_serialization_spec.lua b/spec/util_serialization_spec.lua
index 180a2135..8783e636 100644
--- a/spec/util_serialization_spec.lua
+++ b/spec/util_serialization_spec.lua
@@ -19,6 +19,13 @@ describe("util.serialization", function ()
assert.is_string(serialization.serialize(function () end, "debug"));
end);
+ it("rejects cycles", function ()
+ assert.has_error(function ()
+ local t = {}
+ t[t] = { t };
+ serialization.serialize(t)
+ end);
+ end);
it("roundtrips", function ()
local function test(data)