mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
test: reduce exec_lua calls
`exec_lua` makes code slighly harder to read, so it's beneficial to remove it in cases where it's possible or convenient. Not all `exec_lua` calls should be removed even if the test passes as it changes the semantics of the test even if it happens to pass. From https://github.com/neovim/neovim/pull/28155#discussion_r1548185779: "Note for tests like this, which fundamentally are about conversion, you end up changing what conversion you are testing. Even if the result happens to be same (as they often are, as we like the rules to be consistent if possible), you are now testing the RPC conversion rules instead of the vim script to in-process lua conversion rules." From https://github.com/neovim/neovim/pull/28155#discussion_r1548190152: "A test like this specifies that the cursor is valid immediately and not after a separate cycle of normal (or an other input-processing) mode."
This commit is contained in:
@@ -5,6 +5,7 @@ local ok = helpers.ok
|
||||
local exec_lua = helpers.exec_lua
|
||||
local matches = helpers.matches
|
||||
local pcall_err = helpers.pcall_err
|
||||
local fn = helpers.fn
|
||||
|
||||
local function v(ver)
|
||||
return vim.version._version(ver)
|
||||
@@ -17,7 +18,7 @@ describe('version', function()
|
||||
end)
|
||||
|
||||
it('version() returns Nvim version', function()
|
||||
local expected = exec_lua('return vim.fn.api_info().version')
|
||||
local expected = fn.api_info().version
|
||||
local actual = exec_lua('return vim.version()')
|
||||
eq(expected.major, actual.major)
|
||||
eq(expected.minor, actual.minor)
|
||||
|
||||
Reference in New Issue
Block a user