diff options
author | Kim Alvefur <zash@zash.se> | 2020-04-23 18:17:54 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-04-23 18:17:54 +0200 |
commit | 67372d19bdab286a5900494a0be694aacec7d9b6 (patch) | |
tree | b3035e5a9c8c68b60fd292c84d71d597039b8094 /spec | |
parent | 93535db346af6b10a1778f91235b7a9429e6ead0 (diff) | |
download | prosody-67372d19bdab286a5900494a0be694aacec7d9b6.tar.gz prosody-67372d19bdab286a5900494a0be694aacec7d9b6.zip |
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".
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util_rsm_spec.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/util_rsm_spec.lua b/spec/util_rsm_spec.lua index c8ddc47d..08fb1b02 100644 --- a/spec/util_rsm_spec.lua +++ b/spec/util_rsm_spec.lua @@ -77,6 +77,13 @@ describe("util.rsm", function () assert.same(test:get_child_text("before"), res:get_child_text("before")); end); + it("handles floats", function () + local r1 = rsm.generate({ max = 10.0, count = 100.0, first = { index = 1.0, "foo" } }); + assert.equal("10", r1:get_child_text("max")); + assert.equal("100", r1:get_child_text("count")); + assert.equal("1", r1:get_child("first").attr.index); + end); + end); end); |