# HG changeset patch # User Kim Alvefur # Date 1539290888 -7200 # Node ID f34c635c5f426f84a37dfe2aec1f5375c6061d66 # Parent 006a71a83e6afc40b10233e953a82c7e20768846 util.serialization: Test that it rejects tables wit cycles diff -r 006a71a83e6a -r f34c635c5f42 spec/util_serialization_spec.lua --- 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)