Software /
code /
prosody
Diff
spec/util_serialization_spec.lua @ 9480:006a71a83e6a
util.serialization: Make errors fatal by default (like the previous implementation)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 11 Oct 2018 22:42:17 +0200 |
parent | 9343:e767da06399d |
child | 9481:f34c635c5f42 |
line wrap: on
line diff
--- a/spec/util_serialization_spec.lua Thu Oct 11 18:20:09 2018 +0100 +++ b/spec/util_serialization_spec.lua Thu Oct 11 22:42:17 2018 +0200 @@ -7,9 +7,19 @@ assert.is_string(serialization.serialize(nil)); assert.is_string(serialization.serialize(1)); assert.is_string(serialization.serialize(true)); - assert.is_string(serialization.serialize(function () end)); end); + it("rejects function by default", function () + assert.has_error(function () + serialization.serialize(function () end) + end); + end); + + it("makes a string in debug mode", function () + assert.is_string(serialization.serialize(function () end, "debug")); + end); + + it("roundtrips", function () local function test(data) local serialized = serialization.serialize(data);