From ce56ad2ba7c93c5053b657cd99642b375a944607 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 23 Jul 2023 12:46:56 +0800 Subject: test: reduce flakiness (#24443) Avoid consecutive RPC requests involving :startinsert or :stopinsert, because consecutive RPC requests may be processed together, before the :startinsert or :stopinsert takes effect. Also change some feed_command() to command() to make tests faster. --- test/functional/terminal/helpers.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test/functional/terminal/helpers.lua') diff --git a/test/functional/terminal/helpers.lua b/test/functional/terminal/helpers.lua index 7247361649..62d3dd67a3 100644 --- a/test/functional/terminal/helpers.lua +++ b/test/functional/terminal/helpers.lua @@ -5,7 +5,7 @@ local helpers = require('test.functional.helpers')(nil) local Screen = require('test.functional.ui.screen') local testprg = helpers.testprg local exec_lua = helpers.exec_lua -local feed_command, nvim = helpers.feed_command, helpers.nvim +local nvim = helpers.nvim local function feed_data(data) if type(data) == 'table' then @@ -82,15 +82,16 @@ local function screen_setup(extra_rows, command, cols, opts) screen:attach(opts or {rgb=false}) - feed_command('enew | call termopen('..command..')') + nvim('command', 'enew | call termopen('..command..')') nvim('input', '') local vim_errmsg = nvim('eval', 'v:errmsg') if vim_errmsg and "" ~= vim_errmsg then error(vim_errmsg) end - feed_command('setlocal scrollback=10') - feed_command('startinsert') + nvim('command', 'setlocal scrollback=10') + nvim('command', 'startinsert') + nvim('input', '') -- Add input to separate two RPC requests -- tty-test puts the terminal into raw mode and echoes input. Tests work by -- feeding termcodes to control the display and asserting by screen:expect. -- cgit