neovim/test/functional/lua
Gregory Anders 5fa26e2c2f feat: add trimempty optional parameter to vim.split
The `split()` VimL function trims empty items from the returned list by
default, so that, e.g.

  split("\nhello\nworld\n\n", "\n")

returns

  ["hello", "world"]

The Lua implementation of vim.split does not do this. For example,

  vim.split("\nhello\nworld\n\n", "\n")

returns

  {'', 'hello', 'world', '', ''}

Add an optional parameter to the vim.split function that, when true,
trims these empty elements from the front and back of the returned
table. This is only possible for vim.split and not vim.gsplit; because
vim.gsplit is an iterator, there is no way for it to know if the current
item is the last non-empty item.

Note that in order to preserve backward compatibility, the parameter for
the Lua vim.split function is `trimempty`, while the VimL function uses
`keepempty` (i.e. they are opposites). This means there is a disconnect
between these two functions that may surprise users.
2021-09-25 20:11:30 -06:00
..
api_spec.lua feat(decode_string): decode binary string with NULs to Blob 2021-09-15 21:19:30 +01:00
buffer_updates_spec.lua fix(bufupdates): send correct updates for visual paste 2021-08-25 15:11:39 +02:00
command_line_completion_spec.lua lint 2021-01-26 17:09:35 -08:00
commands_spec.lua refactor(tests): remove redir_exec #15718 2021-09-19 02:29:37 -07:00
diagnostic_spec.lua feat(diagnostic): allow customized diagnostic messages (#15742) 2021-09-22 12:20:15 -07:00
highlight_spec.lua tests(lua/on_yank): assert conditions that fail correctly #15495 2021-08-27 04:54:01 -07:00
loop_spec.lua lua: add vim.in_fast_event() to check if we are in a luv callback 2019-08-05 13:57:24 +02:00
luaeval_spec.lua feat(decode_string): decode binary string with NULs to Blob 2021-09-15 21:19:30 +01:00
mpack_spec.lua feat(lua): make vim.mpack support vim.NIL and vim.empty_dict() 2021-09-09 16:06:43 +02:00
overrides_spec.lua refactor(tests): remove redir_exec #15718 2021-09-19 02:29:37 -07:00
runtime_spec.lua refactor(tests): Simplify tests at functional/lua/runtime_spec 2021-06-11 01:01:03 +06:00
uri_spec.lua feat(vim.uri): Allow URI schemes other than file: without authority 2021-07-10 18:27:37 +01:00
vim_spec.lua feat: add trimempty optional parameter to vim.split 2021-09-25 20:11:30 -06:00
xdiff_spec.lua feat(api): add lua C bindings for xdiff (#14536) 2021-08-22 12:22:04 +02:00