summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/lua/mpack_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-03-21fix(mpack): boundary values for negative integer encoding #37255benarcher26911
Problem: libmpack encodes boundary values -129 and -32769 with wrong integer sizes: - -129 as int8 instead of int16 - -32769 as int16 instead of int32 because the boundary checks compare against the wrong values (e.g., lo < 0xffffff7f instead of lo < 0xffffff80). This caused data corruption: -129 would decode as 127. Solution: Fix off-by-one errors in the two's complement boundary constants: 0xffffff80 (-128, min int8) and 0xffff8000 (-32768, min int16). Fixes #37202 Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-01fix(msgpack): use fixstr encoding for strings of length 20-31 #36737benarcher26911
Problem: MessagePack fixstr format supports string lengths 0-31, but mpack_str() only used fixstr for lengths < 20. Strings of 20-31 bytes were incorrectly encoded as str8 (2-byte header) instead of fixstr (1-byte header). Solution: Change the condition from `len < 20` to `len < 32` to match the MessagePack specification. This fix affects message timing which exposed a pre-existing race condition in the channels_spec PTY test. The test now uses a helper function to accumulate partial PTY reads, making it more robust. Fixes #32784
2024-09-21test: support upvalues in exec_luaLewis Russell1
2024-04-23test: improve test conventionsdundargoc1
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
2024-04-21refactor(lua): rename tbl_islist => islistJustin M. Keyes1
ref #24572
2024-04-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-01-03refactor: format test/*Justin M. Keyes1
2021-10-30fix(vim.mpack): rename pack/unpack => encode/decode #16175Justin M. Keyes1
Problem: 1. "unpack" has an unrelated meaning in Lua: https://www.lua.org/manual/5.1/manual.html#pdf-unpack 2. We already have msgpackparse()/msgpackdump() and json_encode()/json_decode(), so introducing another name for the same thing is entropy. Solution: - Rename vim.mpack.pack/unpack => vim.mpack.encode/decode Caveat: This is incongruent with the `Unpacker` and `Packer` functions. - It's probably too invasive to rename those. - They also aren't part of our documented interface. - This commit is "reversible" in the sense that we can always revert it and add `vim.mpack.encode/decode` as _aliases_ to `vim.mpack.pack/unpack`, at any time in the future, if we want stricter fidelity with upstream libmpack. Meanwhile, `vim.mpack.encode/decode` is currently the total _documented_ interface of `vim.mpack`, so this change serves the purpose of consistent naming in the Nvim stdlib.
2021-09-09feat(lua): make vim.mpack support vim.NIL and vim.empty_dict()Björn Linse1