Changeset

9481:f34c635c5f42

util.serialization: Test that it rejects tables wit cycles
author Kim Alvefur <zash@zash.se>
date Thu, 11 Oct 2018 22:48:08 +0200
parents 9480:006a71a83e6a
children 9482:8791bfa3984a
files spec/util_serialization_spec.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/spec/util_serialization_spec.lua	Thu Oct 11 22:42:17 2018 +0200
+++ b/spec/util_serialization_spec.lua	Thu Oct 11 22:48:08 2018 +0200
@@ -19,6 +19,13 @@
 			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)