aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_serialization_spec.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-27 12:40:47 +0200
committerKim Alvefur <zash@zash.se>2018-10-27 12:40:47 +0200
commit2801e1f10087b21a7ca8c0a10a11de5ac10c259d (patch)
treec007ce6ece6725cbff2866236ee9fe4e761573cf /spec/util_serialization_spec.lua
parentbdadc69e1a9c86b65ddbbb8b53e36e06ded9fad3 (diff)
downloadprosody-2801e1f10087b21a7ca8c0a10a11de5ac10c259d.tar.gz
prosody-2801e1f10087b21a7ca8c0a10a11de5ac10c259d.zip
util.serialization: Test rejection of multiple references to same table
Diffstat (limited to 'spec/util_serialization_spec.lua')
-rw-r--r--spec/util_serialization_spec.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/util_serialization_spec.lua b/spec/util_serialization_spec.lua
index d22cf738..e73ca826 100644
--- a/spec/util_serialization_spec.lua
+++ b/spec/util_serialization_spec.lua
@@ -27,6 +27,14 @@ describe("util.serialization", function ()
end);
end);
+ it("rejects multiple references to same table", function ()
+ assert.has_error(function ()
+ local t1 = {};
+ local t2 = { t1, t1 };
+ serialization.serialize(t2);
+ end);
+ end);
+
it("roundtrips", function ()
local function test(data)
local serialized = serialization.serialize(data);