diff options
| author | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2026-01-16 18:49:14 +0200 |
|---|---|---|
| committer | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2026-01-16 18:49:14 +0200 |
| commit | b4dd11cd5d9ac1568cbeae43caf1a6131781ea63 (patch) | |
| tree | 80f88413f71ec261029e3901f7be0113695b427a /test/functional/vimscript/executable_spec.lua | |
| parent | 0232a63fa53b6875c8e6e2022a92693affb5c17d (diff) | |
| download | rneovim-b4dd11cd5d9ac1568cbeae43caf1a6131781ea63.tar.gz rneovim-b4dd11cd5d9ac1568cbeae43caf1a6131781ea63.tar.bz2 rneovim-b4dd11cd5d9ac1568cbeae43caf1a6131781ea63.zip | |
test(pack): use a helper to `vim.pack.add` inside `testnvim` instance
Problem: A lot of test cases require executing `vim.pack.add()` inside
`testnvim` instance to install and/or add plugins. This requires
access to the information about tested repo sources (stored in a Lua
variable inside a runner instance), so it needs to go
`exec_lua(function() vim.pack.add({...}) end)` route, which in
formatted form adds two more lines. Since it is very frequent, it pads
test files with (mostly avoidable and unncessary) lines.
Solution: Add `vim_pack_add()` helper specifically to execute
`vim.pack.add` inside `testnvim` instance. Use it where possible:
usually when `vim.pack.add` is not a subject of the test. It is not
quite doable for some cases, though:
- When error in `vim.pack.add` is tested.
- When specification includes `vim.version.range` (since `exec_lua`
seems to not transfer necessary class metatables).
This removes ~100 lines from the file at the cost of sometimes using
`vim_pack_add` and sometimes having to reside to `vim.pack.add`.
Which seems like a positive trade-off.
This also allows making a more compact `exec_lua('vim.pack.update()')`
instructions since `vim.pack.update` doesn't depend on the upvalues
stored in test runner instance.
Diffstat (limited to 'test/functional/vimscript/executable_spec.lua')
0 files changed, 0 insertions, 0 deletions