neovim

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

commit 86a4588d4ae26edfdbdabf2442967757521a05c0
parent 976a47e81be085df9aac497be0f40a7f6a4d0345
Author: glepnir <glephunter@gmail.com>
Date:   Mon, 15 Dec 2025 15:11:23 +0800

test: remove feed_command in undo_spec #36953

Problem: feed_command is marked as deprecated.

Solution: replace it with command and pcall_err.
Diffstat:
Mtest/functional/editor/undo_spec.lua | 29+++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/test/functional/editor/undo_spec.lua b/test/functional/editor/undo_spec.lua @@ -3,15 +3,14 @@ local n = require('test.functional.testnvim')() local clear = n.clear local command = n.command -local eval = n.eval local expect = n.expect local eq = t.eq local feed = n.feed -local feed_command = n.feed_command local insert = n.insert local fn = n.fn local exec = n.exec local exec_lua = n.exec_lua +local pcall_err = t.pcall_err local function lastmessage() local messages = fn.split(fn.execute('messages'), '\n') @@ -172,7 +171,7 @@ describe(':undo! command', function() feed('o99 little bugs in the code<Esc>') end) it('works', function() - feed_command('undo!') + command('undo!') expect([[ 1 little bug in the code 1 little bug in the code @@ -181,7 +180,7 @@ describe(':undo! command', function() eq('Already at newest change', lastmessage()) end) it('works with arguments', function() - feed_command('undo! 2') + command('undo! 2') expect([[ 1 little bug in the code 1 little bug in the code]]) @@ -190,7 +189,7 @@ describe(':undo! command', function() end) it('correctly sets alternative redo', function() feed('uo101 little bugs in the code<Esc>') - feed_command('undo!') + command('undo!') feed('<C-r>') expect([[ 1 little bug in the code @@ -200,7 +199,7 @@ describe(':undo! command', function() feed('uuoTake 2 down, patch them around<Esc>') feed('o101 little bugs in the code<Esc>') - feed_command('undo! 2') + command('undo! 2') feed('<C-r><C-r>') expect([[ 1 little bug in the code @@ -209,14 +208,20 @@ describe(':undo! command', function() 99 little bugs in the code]]) end) it('fails when attempting to redo or move to different undo branch', function() - feed_command('undo! 4') - eq('E5767: Cannot use :undo! to redo or move to a different undo branch', eval('v:errmsg')) + eq( + 'Vim(undo):E5767: Cannot use :undo! to redo or move to a different undo branch', + pcall_err(command, 'undo! 4') + ) feed('u') - feed_command('undo! 4') - eq('E5767: Cannot use :undo! to redo or move to a different undo branch', eval('v:errmsg')) + eq( + 'Vim(undo):E5767: Cannot use :undo! to redo or move to a different undo branch', + pcall_err(command, 'undo! 4') + ) feed('o101 little bugs in the code<Esc>') feed('o101 little bugs in the code<Esc>') - feed_command('undo! 4') - eq('E5767: Cannot use :undo! to redo or move to a different undo branch', eval('v:errmsg')) + eq( + 'Vim(undo):E5767: Cannot use :undo! to redo or move to a different undo branch', + pcall_err(command, 'undo! 4') + ) end) end)