Diff

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
parent 9485:c667887d78ad
child 9567:dbfa286cfa88
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);