From 1a0be02fe85a105c48b82aac82c6d082a08f25b0 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 28 Oct 2021 13:00:24 +0200 Subject: util.dataforms: Ensure larger integers are serialized as such Assumes that most number fields are integers, as most numeric types listed in XEP-0122 are, as are all such fields in Prosody as of this. Otherwise %g produces something like 1.1259e+15 --- spec/util_dataforms_spec.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'spec') diff --git a/spec/util_dataforms_spec.lua b/spec/util_dataforms_spec.lua index 426dce33..e0a9bb9b 100644 --- a/spec/util_dataforms_spec.lua +++ b/spec/util_dataforms_spec.lua @@ -458,6 +458,12 @@ describe("util.dataforms", function () assert.table(e); assert.string(e.number); end); + + it("serializes largeer ints okay", function () + local x = f:form{number=1125899906842624} + assert.equal("1125899906842624", x:find("field/value#")) + end); + end) describe("datetime", function () -- cgit v1.2.3