neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 83d22e0979fcc734326196975899f8eb3674c809
parent 4bbdffe8298e8bf6e0590684092a25f5effc0f14
Author: Justin M. Keyes <justinkz@gmail.com>
Date:   Thu, 20 Nov 2025 01:11:17 -0500

refactor: deduplicate test

Diffstat:
Mtest/functional/lua/net_spec.lua | 22+++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/test/functional/lua/net_spec.lua b/test/functional/lua/net_spec.lua @@ -39,35 +39,23 @@ describe('vim.net.request', function() ) end) - it('detects filetype for remote content', function() + it("detects filetype, sets 'nomodified'", function() t.skip(skip_integ, 'NVIM_TEST_INTEG not set: skipping network integration test') - local ft = exec_lua([[ + local rv = exec_lua([[ vim.cmd('runtime! plugin/nvim/net.lua') vim.cmd('runtime! filetype.lua') -- github raw dump of a small lua file in the neovim repo vim.cmd('edit https://raw.githubusercontent.com/neovim/neovim/master/runtime/syntax/tutor.lua') vim.wait(2000, function() return vim.bo.filetype ~= '' end) - return vim.bo.filetype - ]]) - - assert(ft == 'lua', 'Expected filetype to be "lua", got: ' .. tostring(ft)) - end) - - it('removes the modified flag from the buffer for remote content', function() - t.skip(skip_integ, 'NVIM_TEST_INTEG not set: skipping network integration test') - - local buffer_modified = exec_lua([[ - vim.cmd('runtime! plugin/nvim/net.lua') - vim.cmd('runtime! filetype.lua') - vim.cmd('edit https://raw.githubusercontent.com/neovim/neovim/master/runtime/syntax/tutor.lua') -- wait for buffer to have content vim.wait(2000, function() return vim.fn.wordcount().bytes > 0 end) vim.wait(2000, function() return vim.bo.modified == false end) - return vim.bo.modified + return { vim.bo.filetype, vim.bo.modified } ]]) - assert(not buffer_modified, 'Expected buffer to be unmodified for remote content') + t.eq('lua', rv[1]) + t.eq(false, rv[2], 'Expected buffer to be unmodified for remote content') end) it('calls on_response with error on 404 (async failure)', function()