mirror of
https://github.com/neovim/neovim.git
synced 2025-11-08 19:45:12 +00:00
test(lua/ui_spec): fix Ctrl-C test flakiness (#21039)
Prevent Ctrl-C from flushing the command that starts the prompt.
This commit is contained in:
@@ -4,6 +4,7 @@ local exec_lua = helpers.exec_lua
|
|||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
|
local poke_eventloop = helpers.poke_eventloop
|
||||||
|
|
||||||
describe('vim.ui', function()
|
describe('vim.ui', function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
@@ -114,6 +115,7 @@ describe('vim.ui', function()
|
|||||||
it('can return nil when interrupted with Ctrl-C #18144', function()
|
it('can return nil when interrupted with Ctrl-C #18144', function()
|
||||||
feed(':lua result = "on_confirm not called"<cr>')
|
feed(':lua result = "on_confirm not called"<cr>')
|
||||||
feed(':lua vim.ui.input({}, function(input) result = input end)<cr>')
|
feed(':lua vim.ui.input({}, function(input) result = input end)<cr>')
|
||||||
|
poke_eventloop() -- This is needed because Ctrl-C flushes input
|
||||||
feed('Inputted Text<c-c>')
|
feed('Inputted Text<c-c>')
|
||||||
eq(true, exec_lua('return (nil == result)'))
|
eq(true, exec_lua('return (nil == result)'))
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user