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.
Problem:
The Lua-API bridge allows Dict params to be empty Lua (list) tables at
the function-signature level. But not for _nested_ Dicts, because they
are not modeled:
fae7540732/src/nvim/api/keysets.lua (L184)
Some API functions like nvim_cmd check for kObjectTypeDictionary and
don't handle the case of empty Lua tables (treated as "Array").
Solution:
Introduce VALIDATE_T_DICT and use it in places where
kObjectTypeDictionary was being checked directly.
fixes#21005
Problem:
Validation messages are not consistently formatted.
- Parameter names sometimes are NOT quoted.
- Descriptive names (non-parameters) sometimes ARE quoted.
Solution:
Always quote the `name` value passed to a VALIDATE macro _unless_ the
value has whitespace.
Problem:
- API validation involves too much boilerplate.
- API validation errors are not consistently worded.
Solution:
Introduce some macros. Currently these are clumsy, but they at least
help with consistency and avoid some nesting.
Adds a `name` key to the opts dict passed to Lua command callbacks
created using `nvim_create_user_command()`. This is useful for when
multiple commands use the same callback.
Note that this kind of behavior is not as strange as one might think,
even some internal Neovim commands reuse the same internal C function,
differing their behavior by checking the command name. `substitute`,
`smagic` and `snomagic` are examples of that.
This will also be useful for generalized Lua command preview functions
that can preview a wide range of commands, in which case knowing the
command name is necessary for the preview function to actually be able
to execute the command that it's supposed to preview.
I don't think using an integer as a NUL-terminated string can work on
big-endian systems, at least.
This is also not tested. Add a test.
Also fix a mistake in the docs of nvim_parse_cmd.
Now nvim_parse_cmd and nvim_create_user_command use a "tab" value which
is the same as the number passed before :tab modifier instead of the
number plus 1, and "tab" value is -1 if :tab modifier is not used.
Problem: A command defined with `nargs="?"` returns `fargs={""}` to
a Lua callback when executed with no arguments, which is inconsistent
with how`nargs="*"` behaves.
Solution: Pass `fargs={}` for no argument with `nargs="?"` as well.
Adds an `smods` key to `nvim_create_user_command` Lua command callbacks,
which has command modifiers but in a structured format. This removes the
need to manually parse command modifiers. It also reduces friction in
using `nvim_cmd` inside a Lua command callback.
Skip runs of whitespace and do not include `\` characters when
followed by another `\` or whitespace. This matches the behavior
of <f-args> when used with `:command`.
helpers.source() was a hack to work around the lack of anonymous
:source. Its "create tempfile" behavior is not a required part of most
tests that use it.
Some tests still need the old "create tempfile" behavior either because
they test SID behavior, or because of missing nvim_exec features: #16071
Works similar to ex <f-args>. It only splits the arguments if the
command has more than one posible argument. In cases were the command
can only have 1 argument opts.fargs = { opts.args }
Problem: "verbose set efm" reports the location of the :compiler command.
(Gary Johnson)
Solution: Add the "-keepscript" argument to :command and use it when
defining CompilerSet.
58ef8a31d7
Do not copy a lot of lua strings (dict keys) to just strequal() them
Just compare them directly to a dedicated hash function.
feat(generators): HASHY McHASHFACE
Problem: No error when using :complete for :command without -nargs.
Solution: Give an error. (Martin Tournoij, closesvim/vim#8544, closesvim/vim#8541)
de69a7353e
N/A patches for version.c:
vim-patch:8.1.1801: cannot build without the +eval feature
Problem: Cannot build without the +eval feature.
Solution: Always define funcexe_T.
505e43a20e
vim-patch:8.1.1818: unused variable
Problem: Unused variable.
Solution: Remove the variable. (Mike Williams)
b4a88a0441
vim-patch:8.2.1464: Vim9: build warning for unused variable
Problem: Vim9: build warning for unused variable.
Solution: Delete the variable declaration.
829ac868b7
vim-patch:8.2.2639: build failure when fsync() is not available
Problem: Build failure when fsync() is not available.
Solution: Add #ifdef.
5ea79a2599
vim-patch:8.2.2814: Vim9: unused variable
Problem: Vim9: unused variable. (John Marriott)
Solution: Adjust #ifdef.
b06b50dfa0
vim-patch:8.2.2947: build failure without the channel feature
Problem: Build failure without the channel feature.
Solution: Add back #ifdef. (John Marriott)
f5bfa8faa7
vim-patch:8.2.2976: build failure without the +eval feature
Problem: Build failure without the +eval feature.
Solution: Add #ifdefs.
8de901e1f1
vim-patch:8.2.2986: build failure without the profile feature
Problem: Build failure without the profile feature.
Solution: Add #ifdef.
d9f31c13d2
vim-patch:8.2.3114: Amiga-like systems: build error using stat()
Problem: Amiga-like systems: build error using stat().
Solution: Only build swapfile_process_running() on systems where it is
actually used. (Ola Söder, closesvim/vim#8519)
599a6e5b36