Mercurial > vim
comparison src/testdir/test_hlsearch.vim @ 11523:aad2c2ca0774 v8.0.0644
patch 8.0.0644: the timeout for 'hlsearch' is not tested
commit https://github.com/vim/vim/commit/5b1affefd0e96154517ec6f71300086ae6d22d24
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 17 19:13:49 2017 +0200
patch 8.0.0644: the timeout for 'hlsearch' is not tested
Problem: There is no test for 'hlsearch' timing out.
Solution: Add a test.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 17 Jun 2017 19:15:03 +0200 |
parents | eb9a7296ae9f |
children | 14b6b79d685b |
comparison
equal
deleted
inserted
replaced
11522:9457e5cafba4 | 11523:aad2c2ca0774 |
---|---|
30 call assert_fails('let v:hlsearch=[]', 'E745') | 30 call assert_fails('let v:hlsearch=[]', 'E745') |
31 call garbagecollect(1) | 31 call garbagecollect(1) |
32 call getchar(1) | 32 call getchar(1) |
33 enew! | 33 enew! |
34 endfunction | 34 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 |