Files
neovim/test/functional/plugin
Evgeni Chasnovski b4dd11cd5d 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.
2026-01-16 18:49:14 +02:00
..
2026-01-12 03:50:57 +00:00
2025-11-19 20:43:15 -08:00