Changeset

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 9565:9a1e2f5f674f
children 9567:dbfa286cfa88
files spec/util_serialization_spec.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/spec/util_serialization_spec.lua	Sat Oct 27 12:38:47 2018 +0200
+++ b/spec/util_serialization_spec.lua	Sat Oct 27 12:40:47 2018 +0200
@@ -27,6 +27,14 @@
 			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);