mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	test/timer_spec: relax lower-bound
Test is unreliable on macOS 10.13. The lower-bound isn't central to the purpose of the test, so just relax it. 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. related: #6829
This commit is contained in:
		@@ -44,7 +44,7 @@ func Test_repeat_many()
 | 
				
			|||||||
  let timer = timer_start(50, 'MyHandler', {'repeat': -1})
 | 
					  let timer = timer_start(50, 'MyHandler', {'repeat': -1})
 | 
				
			||||||
  sleep 200m
 | 
					  sleep 200m
 | 
				
			||||||
  call timer_stop(timer)
 | 
					  call timer_stop(timer)
 | 
				
			||||||
  call assert_inrange(2, 4, g:val)
 | 
					  call assert_inrange((has('mac') ? 1 : 2), 4, g:val)
 | 
				
			||||||
endfunc
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func Test_with_partial_callback()
 | 
					func Test_with_partial_callback()
 | 
				
			||||||
@@ -167,6 +167,9 @@ func Test_stop_all_in_callback()
 | 
				
			|||||||
  let g:timer1 = timer_start(10, 'StopTimerAll')
 | 
					  let g:timer1 = timer_start(10, 'StopTimerAll')
 | 
				
			||||||
  let info = timer_info()
 | 
					  let info = timer_info()
 | 
				
			||||||
  call assert_equal(1, len(info))
 | 
					  call assert_equal(1, len(info))
 | 
				
			||||||
 | 
					  if has('mac')
 | 
				
			||||||
 | 
					    sleep 100m
 | 
				
			||||||
 | 
					  endif
 | 
				
			||||||
  sleep 40m
 | 
					  sleep 40m
 | 
				
			||||||
  let info = timer_info()
 | 
					  let info = timer_info()
 | 
				
			||||||
  call assert_equal(0, len(info))
 | 
					  call assert_equal(0, len(info))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -82,7 +82,7 @@ describe('timers', function()
 | 
				
			|||||||
    run(nil, nil, nil, 300)
 | 
					    run(nil, nil, nil, 300)
 | 
				
			||||||
    feed("c")
 | 
					    feed("c")
 | 
				
			||||||
    local count = eval("g:val")
 | 
					    local count = eval("g:val")
 | 
				
			||||||
    assert(count >= 4, 'expected count >= 4, got: '..tostring(count))
 | 
					    assert(count >= 3, 'expected count >= 3, got: '..tostring(count))
 | 
				
			||||||
    eq(99, eval("g:c"))
 | 
					    eq(99, eval("g:c"))
 | 
				
			||||||
  end)
 | 
					  end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -144,8 +144,8 @@ describe('timers', function()
 | 
				
			|||||||
    local count2 = eval("g:val")
 | 
					    local count2 = eval("g:val")
 | 
				
			||||||
    -- when count is eval:ed after timer_stop this should be non-racy
 | 
					    -- when count is eval:ed after timer_stop this should be non-racy
 | 
				
			||||||
    eq(count, count2)
 | 
					    eq(count, count2)
 | 
				
			||||||
    assert(4 <= count and count <= 7,
 | 
					    assert(3 <= count and count <= 7,
 | 
				
			||||||
           'expected (4 <= count <= 7), got: '..tostring(count))
 | 
					           'expected (3 <= count <= 7), got: '..tostring(count))
 | 
				
			||||||
  end)
 | 
					  end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('can be stopped from the handler', function()
 | 
					  it('can be stopped from the handler', function()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user