mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
functests: Remove all wait()s
This commit is contained in:
parent
5e6f7e1d55
commit
4c4f741aec
@ -2,7 +2,6 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
|
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local wait = helpers.wait
|
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
@ -51,9 +50,7 @@ describe('input()', function()
|
|||||||
{T:Test} |
|
{T:Test} |
|
||||||
{T:Foo}^ |
|
{T:Foo}^ |
|
||||||
]])
|
]])
|
||||||
wait()
|
|
||||||
command('redraw!')
|
command('redraw!')
|
||||||
wait()
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
@ -65,9 +62,7 @@ describe('input()', function()
|
|||||||
it('works correctly with multiple numeric arguments (many args)', function()
|
it('works correctly with multiple numeric arguments (many args)', function()
|
||||||
command('hi Test ctermfg=Red guifg=Red term=bold')
|
command('hi Test ctermfg=Red guifg=Red term=bold')
|
||||||
feed([[:echohl Test | call input(1, 2)<CR>]])
|
feed([[:echohl Test | call input(1, 2)<CR>]])
|
||||||
wait() -- Without wait() it first shows `12` line and then empty line.
|
|
||||||
command('redraw!') -- Without this it shows two `12` lines.
|
command('redraw!') -- Without this it shows two `12` lines.
|
||||||
wait()
|
|
||||||
-- None of the above problems happen when testing manually.
|
-- None of the above problems happen when testing manually.
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
@ -77,7 +72,6 @@ describe('input()', function()
|
|||||||
{T:1}2^ |
|
{T:1}2^ |
|
||||||
]])
|
]])
|
||||||
feed('<BS>')
|
feed('<BS>')
|
||||||
wait()
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
@ -88,7 +82,6 @@ describe('input()', function()
|
|||||||
end)
|
end)
|
||||||
it('works correctly with multiple numeric arguments (dict arg)', function()
|
it('works correctly with multiple numeric arguments (dict arg)', function()
|
||||||
feed([[:echohl Test | echo input({"prompt": 1, "default": 2, "cancelreturn": 3})<CR>]])
|
feed([[:echohl Test | echo input({"prompt": 1, "default": 2, "cancelreturn": 3})<CR>]])
|
||||||
wait() -- Without wait() it first shows `12` line and then empty line.
|
|
||||||
command('redraw!') -- Without this it shows two `12` lines.
|
command('redraw!') -- Without this it shows two `12` lines.
|
||||||
-- None of the above problems happen when testing manually.
|
-- None of the above problems happen when testing manually.
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
@ -99,7 +92,6 @@ describe('input()', function()
|
|||||||
{T:1}2^ |
|
{T:1}2^ |
|
||||||
]])
|
]])
|
||||||
feed('<BS>')
|
feed('<BS>')
|
||||||
wait()
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
@ -108,7 +100,6 @@ describe('input()', function()
|
|||||||
{T:1}^ |
|
{T:1}^ |
|
||||||
]])
|
]])
|
||||||
feed('<Esc>')
|
feed('<Esc>')
|
||||||
wait()
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^ |
|
^ |
|
||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
@ -119,7 +110,6 @@ describe('input()', function()
|
|||||||
end)
|
end)
|
||||||
it('allows omitting everything with dictionary argument', function()
|
it('allows omitting everything with dictionary argument', function()
|
||||||
feed(':echohl Test | echo input({})<CR>')
|
feed(':echohl Test | echo input({})<CR>')
|
||||||
wait()
|
|
||||||
command('redraw!')
|
command('redraw!')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
@ -131,33 +121,25 @@ describe('input()', function()
|
|||||||
end)
|
end)
|
||||||
it('supports completion', function()
|
it('supports completion', function()
|
||||||
feed(':let var = input("", "", "custom,CustomCompl")<CR>')
|
feed(':let var = input("", "", "custom,CustomCompl")<CR>')
|
||||||
wait()
|
|
||||||
feed('<Tab><CR>')
|
feed('<Tab><CR>')
|
||||||
eq('TEST', meths.get_var('var'))
|
eq('TEST', meths.get_var('var'))
|
||||||
|
|
||||||
feed(':let var = input({"completion": "customlist,CustomListCompl"})<CR>')
|
feed(':let var = input({"completion": "customlist,CustomListCompl"})<CR>')
|
||||||
wait()
|
|
||||||
feed('<Tab><CR>')
|
feed('<Tab><CR>')
|
||||||
wait()
|
|
||||||
eq('FOO', meths.get_var('var'))
|
eq('FOO', meths.get_var('var'))
|
||||||
end)
|
end)
|
||||||
it('supports cancelreturn', function()
|
it('supports cancelreturn', function()
|
||||||
feed(':let var = input({"cancelreturn": "BAR"})<CR>')
|
feed(':let var = input({"cancelreturn": "BAR"})<CR>')
|
||||||
wait()
|
|
||||||
feed('<Esc>')
|
feed('<Esc>')
|
||||||
wait()
|
|
||||||
eq('BAR', meths.get_var('var'))
|
eq('BAR', meths.get_var('var'))
|
||||||
end)
|
end)
|
||||||
it('supports default string', function()
|
it('supports default string', function()
|
||||||
feed(':let var = input("", "DEF1")<CR>')
|
feed(':let var = input("", "DEF1")<CR>')
|
||||||
wait()
|
|
||||||
feed('<CR>')
|
feed('<CR>')
|
||||||
eq('DEF1', meths.get_var('var'))
|
eq('DEF1', meths.get_var('var'))
|
||||||
|
|
||||||
feed(':let var = input({"default": "DEF2"})<CR>')
|
feed(':let var = input({"default": "DEF2"})<CR>')
|
||||||
wait()
|
|
||||||
feed('<CR>')
|
feed('<CR>')
|
||||||
wait()
|
|
||||||
eq('DEF2', meths.get_var('var'))
|
eq('DEF2', meths.get_var('var'))
|
||||||
end)
|
end)
|
||||||
it('errors out on invalid inputs', function()
|
it('errors out on invalid inputs', function()
|
||||||
@ -201,9 +183,7 @@ describe('inputdialog()', function()
|
|||||||
{T:Test} |
|
{T:Test} |
|
||||||
{T:Foo}^ |
|
{T:Foo}^ |
|
||||||
]])
|
]])
|
||||||
wait()
|
|
||||||
command('redraw!')
|
command('redraw!')
|
||||||
wait()
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
@ -215,9 +195,7 @@ describe('inputdialog()', function()
|
|||||||
it('works correctly with multiple numeric arguments (many args)', function()
|
it('works correctly with multiple numeric arguments (many args)', function()
|
||||||
command('hi Test ctermfg=Red guifg=Red term=bold')
|
command('hi Test ctermfg=Red guifg=Red term=bold')
|
||||||
feed([[:echohl Test | call inputdialog(1, 2)<CR>]])
|
feed([[:echohl Test | call inputdialog(1, 2)<CR>]])
|
||||||
wait() -- Without wait() it first shows `12` line and then empty line.
|
|
||||||
command('redraw!') -- Without this it shows two `12` lines.
|
command('redraw!') -- Without this it shows two `12` lines.
|
||||||
wait()
|
|
||||||
-- None of the above problems happen when testing manually.
|
-- None of the above problems happen when testing manually.
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
@ -227,7 +205,6 @@ describe('inputdialog()', function()
|
|||||||
{T:1}2^ |
|
{T:1}2^ |
|
||||||
]])
|
]])
|
||||||
feed('<BS>')
|
feed('<BS>')
|
||||||
wait()
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
@ -238,7 +215,6 @@ describe('inputdialog()', function()
|
|||||||
end)
|
end)
|
||||||
it('works correctly with multiple numeric arguments (dict arg)', function()
|
it('works correctly with multiple numeric arguments (dict arg)', function()
|
||||||
feed([[:echohl Test | echo inputdialog({"prompt": 1, "default": 2, "cancelreturn": 3})<CR>]])
|
feed([[:echohl Test | echo inputdialog({"prompt": 1, "default": 2, "cancelreturn": 3})<CR>]])
|
||||||
wait() -- Without wait() it first shows `12` line and then empty line.
|
|
||||||
command('redraw!') -- Without this it shows two `12` lines.
|
command('redraw!') -- Without this it shows two `12` lines.
|
||||||
-- None of the above problems happen when testing manually.
|
-- None of the above problems happen when testing manually.
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
@ -249,7 +225,6 @@ describe('inputdialog()', function()
|
|||||||
{T:1}2^ |
|
{T:1}2^ |
|
||||||
]])
|
]])
|
||||||
feed('<BS>')
|
feed('<BS>')
|
||||||
wait()
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
@ -258,7 +233,6 @@ describe('inputdialog()', function()
|
|||||||
{T:1}^ |
|
{T:1}^ |
|
||||||
]])
|
]])
|
||||||
feed('<Esc>')
|
feed('<Esc>')
|
||||||
wait()
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^ |
|
^ |
|
||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
@ -269,7 +243,6 @@ describe('inputdialog()', function()
|
|||||||
end)
|
end)
|
||||||
it('allows omitting everything with dictionary argument', function()
|
it('allows omitting everything with dictionary argument', function()
|
||||||
feed(':echohl Test | echo inputdialog({})<CR>')
|
feed(':echohl Test | echo inputdialog({})<CR>')
|
||||||
wait()
|
|
||||||
command('redraw!')
|
command('redraw!')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
@ -281,34 +254,25 @@ describe('inputdialog()', function()
|
|||||||
end)
|
end)
|
||||||
it('supports completion', function()
|
it('supports completion', function()
|
||||||
feed(':let var = inputdialog({"completion": "customlist,CustomListCompl"})<CR>')
|
feed(':let var = inputdialog({"completion": "customlist,CustomListCompl"})<CR>')
|
||||||
wait()
|
|
||||||
feed('<Tab><CR>')
|
feed('<Tab><CR>')
|
||||||
wait()
|
|
||||||
eq('FOO', meths.get_var('var'))
|
eq('FOO', meths.get_var('var'))
|
||||||
end)
|
end)
|
||||||
it('supports cancelreturn', function()
|
it('supports cancelreturn', function()
|
||||||
feed(':let var = inputdialog("", "", "CR1")<CR>')
|
feed(':let var = inputdialog("", "", "CR1")<CR>')
|
||||||
wait()
|
|
||||||
feed('<Esc>')
|
feed('<Esc>')
|
||||||
wait()
|
|
||||||
eq('CR1', meths.get_var('var'))
|
eq('CR1', meths.get_var('var'))
|
||||||
|
|
||||||
feed(':let var = inputdialog({"cancelreturn": "BAR"})<CR>')
|
feed(':let var = inputdialog({"cancelreturn": "BAR"})<CR>')
|
||||||
wait()
|
|
||||||
feed('<Esc>')
|
feed('<Esc>')
|
||||||
wait()
|
|
||||||
eq('BAR', meths.get_var('var'))
|
eq('BAR', meths.get_var('var'))
|
||||||
end)
|
end)
|
||||||
it('supports default string', function()
|
it('supports default string', function()
|
||||||
feed(':let var = inputdialog("", "DEF1")<CR>')
|
feed(':let var = inputdialog("", "DEF1")<CR>')
|
||||||
wait()
|
|
||||||
feed('<CR>')
|
feed('<CR>')
|
||||||
eq('DEF1', meths.get_var('var'))
|
eq('DEF1', meths.get_var('var'))
|
||||||
|
|
||||||
feed(':let var = inputdialog({"default": "DEF2"})<CR>')
|
feed(':let var = inputdialog({"default": "DEF2"})<CR>')
|
||||||
wait()
|
|
||||||
feed('<CR>')
|
feed('<CR>')
|
||||||
wait()
|
|
||||||
eq('DEF2', meths.get_var('var'))
|
eq('DEF2', meths.get_var('var'))
|
||||||
end)
|
end)
|
||||||
it('errors out on invalid inputs', function()
|
it('errors out on invalid inputs', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user