view src/testdir/test_sleep.vim @ 34489:4dd6d243e4f7 v9.1.0152

patch 9.1.0152: Coverity complains about ignoring return value Commit: https://github.com/vim/vim/commit/af7ae8160041e2d17c56945381e9370e7178e596 Author: Christian Brabandt <cb@256bit.org> Date: Wed Mar 6 19:31:39 2024 +0100 patch 9.1.0152: Coverity complains about ignoring return value Problem: Coverity complains about ignoring return value of win_split() (after v9.1.150) Solution: Check if win_split() failed, add winfixbuf.res to Makefile
author Christian Brabandt <cb@256bit.org>
date Wed, 06 Mar 2024 21:00:08 +0100
parents 98774a275d6d
children
line wrap: on
line source

" Test for sleep and sleep! commands

func! s:get_time_ms()
  return float2nr(reltimefloat(reltime()) * 1000)
endfunc

func! s:assert_takes_longer(cmd, time_ms)
  let start = s:get_time_ms()
  execute a:cmd
  let end = s:get_time_ms()
  call assert_true(end - start >=# a:time_ms)
endfun

func! Test_sleep_bang()
  call s:assert_takes_longer('sleep 50m', 50)
  call s:assert_takes_longer('sleep! 50m', 50)
  call s:assert_takes_longer('sl 50m', 50)
  call s:assert_takes_longer('sl! 50m', 50)
  call s:assert_takes_longer('1sleep', 1000)
  call s:assert_takes_longer('normal 1gs', 1000)
endfunc

" vim: shiftwidth=2 sts=2 expandtab