diff options
author | Kim Alvefur <zash@zash.se> | 2018-10-11 22:42:17 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-10-11 22:42:17 +0200 |
commit | b7fd262a4c458336e99ed1942bfe190aa02b932c (patch) | |
tree | e333c48dc1a8a6977683942e033940f3f7066e66 /spec | |
parent | d076a3e6c77d38a7b0b4fab9e6c8986a2745a78c (diff) | |
download | prosody-b7fd262a4c458336e99ed1942bfe190aa02b932c.tar.gz prosody-b7fd262a4c458336e99ed1942bfe190aa02b932c.zip |
util.serialization: Make errors fatal by default (like the previous implementation)
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util_serialization_spec.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/spec/util_serialization_spec.lua b/spec/util_serialization_spec.lua index f50bdf23..180a2135 100644 --- a/spec/util_serialization_spec.lua +++ b/spec/util_serialization_spec.lua @@ -7,9 +7,19 @@ describe("util.serialization", function () 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); |