diff options
| author | jade <jadel@mercury.com> | 2025-07-10 19:07:56 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-10 19:07:56 -0700 |
| commit | 7a69fefdb95daba355aa1b05ebfdf4d0b0d51ec2 (patch) | |
| tree | a6f20ce315fdba5500ca7779e95b8123638e66f6 /test/functional/lua | |
| parent | 00f8f94d5b06e5d464a4d5548dc6a91bd2dfdd64 (diff) | |
| download | rneovim-7a69fefdb95daba355aa1b05ebfdf4d0b0d51ec2.tar.gz rneovim-7a69fefdb95daba355aa1b05ebfdf4d0b0d51ec2.tar.bz2 rneovim-7a69fefdb95daba355aa1b05ebfdf4d0b0d51ec2.zip | |
fix(vim.json): loss of precision on integers >14 digits #34876
Problem: multiple DAP servers keep assuming they can have internal IDs
up to 2**52, which get corrupted by the Neovim JSON encoder.
Solution: change (1) constant and add a test so nobody breaks it while
updating the library.
Fixes: https://github.com/neovim/neovim/issues/24532
Fixes: https://github.com/mfussenegger/nvim-dap/issues/1534
Fixes: https://github.com/facebook/buck2/issues/1032
Diffstat (limited to 'test/functional/lua')
| -rw-r--r-- | test/functional/lua/json_spec.lua | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/functional/lua/json_spec.lua b/test/functional/lua/json_spec.lua index e4a1df1d4c..be13b4e2e4 100644 --- a/test/functional/lua/json_spec.lua +++ b/test/functional/lua/json_spec.lua @@ -77,6 +77,7 @@ describe('vim.json.decode()', function() eq(-100000, exec_lua([[return vim.json.decode(' -100000 ')]])) eq(0, exec_lua([[return vim.json.decode('0')]])) eq(0, exec_lua([[return vim.json.decode('-0')]])) + eq(3053700806959403, exec_lua([[return vim.json.decode('3053700806959403')]])) end) it('parses floating-point numbers', function() @@ -208,6 +209,7 @@ describe('vim.json.encode()', function() end) it('dumps floats', function() + eq('3053700806959403', exec_lua([[return vim.json.encode(3053700806959403)]])) eq('10.5', exec_lua([[return vim.json.encode(10.5)]])) eq('-10.5', exec_lua([[return vim.json.encode(-10.5)]])) eq('-1e-05', exec_lua([[return vim.json.encode(-1e-5)]])) |