summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-06-17 19:13:49 +0200
committerBram Moolenaar <Bram@vim.org>2017-06-17 19:13:49 +0200
commit5b1affefd0e96154517ec6f71300086ae6d22d24 (patch)
tree7f6a7c6fb32fa4957472d2d7f238d2310d0c4ee2 /src/testdir
parentfbd0b0af6800f6ff89857863d6a07ea03f09ff6c (diff)
downloadvim-git-5b1affefd0e96154517ec6f71300086ae6d22d24.tar.gz
patch 8.0.0644: the timeout for 'hlsearch' is not testedv8.0.0644
Problem: There is no test for 'hlsearch' timing out. Solution: Add a test.
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_hlsearch.vim18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/testdir/test_hlsearch.vim b/src/testdir/test_hlsearch.vim
index 066fdd025..b934d38e1 100644
--- a/src/testdir/test_hlsearch.vim
+++ b/src/testdir/test_hlsearch.vim
@@ -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