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
commit69f91fa214e6fc7743039c61f2aeed23b376d684 (patch)
tree3a583a4166cda101a1dce5935cf7ac438198fc2a /spec/util_serialization_spec.lua
parente99c680a142058b21d3bfbd61d50fa4dc63cbd17 (diff)
downloadprosody-69f91fa214e6fc7743039c61f2aeed23b376d684.tar.gz
prosody-69f91fa214e6fc7743039c61f2aeed23b376d684.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)