Diff

spec/util_dataforms_spec.lua @ 11880:d30c81b875f2

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
author Kim Alvefur <zash@zash.se>
date Thu, 28 Oct 2021 13:00:24 +0200
parent 11879:b8b889ba8d27
child 12387:05c250fa335a
line wrap: on
line diff
--- a/spec/util_dataforms_spec.lua	Tue Oct 26 15:41:54 2021 +0200
+++ b/spec/util_dataforms_spec.lua	Thu Oct 28 13:00:24 2021 +0200
@@ -458,6 +458,12 @@
 				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 ()