]> granicus.if.org Git - vim/commitdiff
patch 8.0.0644: the timeout for 'hlsearch' is not tested v8.0.0644
authorBram Moolenaar <Bram@vim.org>
Sat, 17 Jun 2017 17:13:49 +0000 (19:13 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 17 Jun 2017 17:13:49 +0000 (19:13 +0200)
Problem:    There is no test for 'hlsearch' timing out.
Solution:   Add a test.

src/testdir/test_hlsearch.vim
src/version.c

index 066fdd0250476c3ce3e6246e9f35ed3c384c0dc2..b934d38e1830d613e73615105b35ade585aeea5f 100644 (file)
@@ -32,3 +32,21 @@ function! Test_hlsearch()
   call getchar(1)
   enew!
 endfunction
+
+func Test_hlsearch_hangs()
+  if !has('reltime') || !has('float')
+    return
+  endif
+
+  " This pattern takes forever to match, it should timeout.
+  help
+  let start = reltime()
+  set hlsearch nolazyredraw redrawtime=101
+  let @/ = '\%#=2\v(a|\1)*'
+  redraw
+  let elapsed = reltimefloat(reltime(start))
+  call assert_true(elapsed > 0.1)
+  call assert_true(elapsed < 1.0)
+  set nohlsearch redrawtime&
+  quit
+endfunc
index 268d4d7d20f29072158d5bc59c8bb2d361d57b74..24bb8206b4e9fde9fc70cd939fd1612b49456d8d 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    644,
 /**/
     643,
 /**/