diff options
author | Billy Su <g4691821@gmail.com> | 2019-03-02 12:37:25 +0800 |
---|---|---|
committer | Billy Su <g4691821@gmail.com> | 2019-03-07 23:48:53 +0800 |
commit | 570e41fc08ae80421c2458d90cd14d7c3ba65d76 (patch) | |
tree | 1d3be6ea535769161cf95827a590fc0e5ff7f3dd | |
parent | 241b905b1378c5c45d8d284bb191b16807ff2a44 (diff) | |
download | rneovim-570e41fc08ae80421c2458d90cd14d7c3ba65d76.tar.gz rneovim-570e41fc08ae80421c2458d90cd14d7c3ba65d76.tar.bz2 rneovim-570e41fc08ae80421c2458d90cd14d7c3ba65d76.zip |
vim-patch:8.0.0644: the timeout for 'hlsearch' is not tested
Problem: There is no test for 'hlsearch' timing out.
Solution: Add a test.
https://github.com/vim/vim/commit/5b1affefd0e96154517ec6f71300086ae6d22d24
-rw-r--r-- | src/nvim/testdir/test_hlsearch.vim | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_hlsearch.vim b/src/nvim/testdir/test_hlsearch.vim index 1fc7b04f88..dd0b05da98 100644 --- a/src/nvim/testdir/test_hlsearch.vim +++ b/src/nvim/testdir/test_hlsearch.vim @@ -32,6 +32,24 @@ function! Test_hlsearch() 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 + func Test_hlsearch_eol_highlight() new call append(1, repeat([''], 9)) |