Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
9479:3a683b2476e2 | 9480:006a71a83e6a |
---|---|
5 it("makes a string", function () | 5 it("makes a string", function () |
6 assert.is_string(serialization.serialize({})); | 6 assert.is_string(serialization.serialize({})); |
7 assert.is_string(serialization.serialize(nil)); | 7 assert.is_string(serialization.serialize(nil)); |
8 assert.is_string(serialization.serialize(1)); | 8 assert.is_string(serialization.serialize(1)); |
9 assert.is_string(serialization.serialize(true)); | 9 assert.is_string(serialization.serialize(true)); |
10 assert.is_string(serialization.serialize(function () end)); | |
11 end); | 10 end); |
11 | |
12 it("rejects function by default", function () | |
13 assert.has_error(function () | |
14 serialization.serialize(function () end) | |
15 end); | |
16 end); | |
17 | |
18 it("makes a string in debug mode", function () | |
19 assert.is_string(serialization.serialize(function () end, "debug")); | |
20 end); | |
21 | |
12 | 22 |
13 it("roundtrips", function () | 23 it("roundtrips", function () |
14 local function test(data) | 24 local function test(data) |
15 local serialized = serialization.serialize(data); | 25 local serialized = serialization.serialize(data); |
16 assert.is_string(serialized); | 26 assert.is_string(serialized); |