Skip to content

Commit 5b1affe

Browse files
committed
patch 8.0.0644: the timeout for 'hlsearch' is not tested
Problem: There is no test for 'hlsearch' timing out. Solution: Add a test.
1 parent fbd0b0a commit 5b1affe

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/testdir/test_hlsearch.vim

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,21 @@ function! Test_hlsearch()
3232
call getchar(1)
3333
enew!
3434
endfunction
35+
36+
func Test_hlsearch_hangs()
37+
if !has('reltime') || !has('float')
38+
return
39+
endif
40+
41+
" This pattern takes forever to match, it should timeout.
42+
help
43+
let start = reltime()
44+
set hlsearch nolazyredraw redrawtime=101
45+
let @/ = '\%#=2\v(a|\1)*'
46+
redraw
47+
let elapsed = reltimefloat(reltime(start))
48+
call assert_true(elapsed > 0.1)
49+
call assert_true(elapsed < 1.0)
50+
set nohlsearch redrawtime&
51+
quit
52+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
644,
767769
/**/
768770
643,
769771
/**/

0 commit comments

Comments
 (0)