aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/json_spec.lua
Commit message (Collapse)AuthorAge
* docs: misc #31479Justin M. Keyes2025-01-01
|
* feat(stdlib): vim.json.encode(...,{escape_slash:boolean}) #30561Bartłomiej Maryńczak2024-12-06
| | | | | | | | | | | | Problem: vim.json.encode escapes every slash in string values (for example in file paths), and is not optional. Use-case is for preventing HTML injections (eg. injecting `</script>` closing tag); in the context of Nvim this is rarely useful. Solution: - Add a `escape_slash` flag to `vim.json.encode`. - Defaults to `false`. (This is a "breaking" change, but more like a bug fix.)
* fix(vim.json): properly treat luanil options as booleans (#28622)zeertzjq2024-05-03
| | | Note: Upstream doesn't have this. It's an Nvim addition.
* test: improve test conventionsdundargoc2024-04-23
| | | | | | | | | 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.
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|
* test: improve test conventionsdundargoc2024-04-08
| | | | Work on https://github.com/neovim/neovim/issues/27004.
* refactor: format test/*Justin M. Keyes2024-01-03
|
* fix(json): allow objects with empty keys #25564Emanuel2023-12-06
| | | | | | | | | | | | | | | | | | | | Problem: Empty string is a valid JSON key, but json_decode() treats an object with empty key as ":help msgpack-special-dict". #20757 :echo json_decode('{"": "1"}') {'_TYPE': [], '_VAL': [['', '1']]} Note: vim returns `{'': '1'}`. Solution: Allow empty string as an object key. Note that we still (currently) disallow empty keys in object_to_vim() (since 7c01d5ff9286d262097484c680e3a4eab49e2911): https://github.com/neovim/neovim/blob/f64e4b43e1191ff30d902730f752875aa55682ce/src/nvim/api/private/converter.c#L333-L334 Fix #20757 Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* fix(vim.json)!: remove global options, "null", "array_mt" #24070Justin M. Keyes2023-06-21
| | | | | | | | | | | | | | | | | | | | | | | | | Problem: - `vim.json` exposes various global options which: - affect all Nvim Lua plugins (especially the LSP client) - are undocumented and untested - can cause confusing problems such as: https://github.com/codota/tabnine-nvim/commit/cc76ae3abe2f129d44b5a8edee2529e0ee0dcf69 - `vim.json` exposes redundant mechanisms: - `vim.json.null` is redundant with `vim.NIL`. - `array_mt` is redundant because Nvim uses a metatable (`vim.empty_dict()`) for empty dict instead, which `vim.json` is configured to use by default (see `as_empty_dict`). Example: ``` :lua vim.print(vim.json.decode('{"bar":[],"foo":{}}')) --> { bar = {}, foo = vim.empty_dict() } ``` Thus we don't need to also decorate empty arrays with `array_mt`. Solution: Remove the functions from the public vim.json interface. Comment-out the implementation code to minimize drift from upstream. TODO: - Expose the options as arguments to `vim.json.new()`
* test: add tests for vim.jsonMichael Lingelbach2021-09-26