mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test: adjust time-sensitive tests (#9220)
- window_split_tab_spec.lua: Put cursor at bottom of :terminal buffer so that it follows output. - inccommand_spec.lua: Increase timeout to allow 2nd retry. - Timer tests are less reliable on Travis CI macOS 10.12/10.13. ref #6829 refe39dade80b
refde13113dc1
ref https://github.com/neovim/neovim/pull/9095#issuecomment-429603452 > We don't guarantee that a X ms timer is triggered during Y ms sleep > for any X<Y, though I would expect the load to be really bad for this > to happen with X=10ms, Y=40ms.
This commit is contained in:
parent
18435a2534
commit
f8639dc99c
@ -31,11 +31,11 @@ function! Test_lambda_with_timer()
|
||||
endfunction
|
||||
|
||||
call s:Foo()
|
||||
sleep 200ms
|
||||
sleep 210ms
|
||||
" do not collect lambda
|
||||
call garbagecollect()
|
||||
let m = s:n
|
||||
sleep 200ms
|
||||
sleep 210ms
|
||||
call timer_stop(s:timer_id)
|
||||
call assert_true(m > 1)
|
||||
call assert_true(s:n > m + 1)
|
||||
|
@ -172,8 +172,8 @@ describe('timers', function()
|
||||
let g:val2 += 1
|
||||
endfunc
|
||||
]])
|
||||
command("call timer_start(50, 'MyHandler', {'repeat': 3})")
|
||||
command("call timer_start(100, 'MyHandler2', {'repeat': 2})")
|
||||
command("call timer_start(20, 'MyHandler', {'repeat': 3})")
|
||||
command("call timer_start(40, 'MyHandler2', {'repeat': 2})")
|
||||
run(nil, nil, nil, 300)
|
||||
eq(3,eval("g:val"))
|
||||
eq(2,eval("g:val2"))
|
||||
|
@ -300,8 +300,10 @@ end
|
||||
-- Calls fn() until it succeeds, up to `max` times or until `max_ms`
|
||||
-- milliseconds have passed.
|
||||
local function retry(max, max_ms, fn)
|
||||
assert(max == nil or max > 0)
|
||||
assert(max_ms == nil or max_ms > 0)
|
||||
local tries = 1
|
||||
local timeout = (max_ms and max_ms > 0) and max_ms or 10000
|
||||
local timeout = (max_ms and max_ms or 10000)
|
||||
local start_time = luv.now()
|
||||
while true do
|
||||
local status, result = pcall(fn)
|
||||
|
@ -68,7 +68,7 @@ describe('terminal', function()
|
||||
end)
|
||||
|
||||
it('forwards resize request to the program', function()
|
||||
feed([[<C-\><C-N>:]]) -- Go to cmdline-mode, so cursor is at bottom.
|
||||
feed([[<C-\><C-N>G:]]) -- Go to cmdline-mode, so cursor is at bottom.
|
||||
local w1, h1 = screen._width - 3, screen._height - 2
|
||||
local w2, h2 = w1 - 6, h1 - 3
|
||||
|
||||
|
@ -2512,7 +2512,7 @@ describe(":substitute", function()
|
||||
end)
|
||||
|
||||
it(':substitute with inccommand during :terminal activity', function()
|
||||
retry(2, nil, function()
|
||||
retry(2, 40000, function()
|
||||
local screen = Screen.new(30,15)
|
||||
clear()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user