Software /
code /
prosody
Comparison
spec/util_rsm_spec.lua @ 10762:4fc224c97986
util.rsm: Test that Lua 5.3 floats are not encoded with decimal point
The 'max' 'count' and 'index' fields are integers and should be encoded
as such on the wire.
Care needs to be taken because tostring(1.0) in Lua 5.3+ returns to "1.0"
while in previous Lua versions it would return "1".
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 23 Apr 2020 18:17:54 +0200 |
parent | 10760:c9d1d9c80e1e |
child | 11427:83f5499d1f10 |
comparison
equal
deleted
inserted
replaced
10761:b53193bb21cc | 10762:4fc224c97986 |
---|---|
75 local res = rsm.generate({ max = 10, before = "peter@pixyland.org" }); | 75 local res = rsm.generate({ max = 10, before = "peter@pixyland.org" }); |
76 assert.same(test:get_child_text("max"), res:get_child_text("max")); | 76 assert.same(test:get_child_text("max"), res:get_child_text("max")); |
77 assert.same(test:get_child_text("before"), res:get_child_text("before")); | 77 assert.same(test:get_child_text("before"), res:get_child_text("before")); |
78 end); | 78 end); |
79 | 79 |
80 it("handles floats", function () | |
81 local r1 = rsm.generate({ max = 10.0, count = 100.0, first = { index = 1.0, "foo" } }); | |
82 assert.equal("10", r1:get_child_text("max")); | |
83 assert.equal("100", r1:get_child_text("count")); | |
84 assert.equal("1", r1:get_child("first").attr.index); | |
85 end); | |
86 | |
80 end); | 87 end); |
81 end); | 88 end); |
82 | 89 |