summaryrefslogtreecommitdiff
path: root/src/testdir/test_hlsearch.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-09-07 20:46:39 +0200
committerBram Moolenaar <Bram@vim.org>2016-09-07 20:46:39 +0200
commit53f1673cd909eb1c809c6a9086e3d104a0df9bed (patch)
tree99ba38cb528eafc2b79ffc13e743da43ea7e9f8e /src/testdir/test_hlsearch.vim
parent1b0c1d050e28f351650c0c84e234fd24f12e5e29 (diff)
downloadvim-git-53f1673cd909eb1c809c6a9086e3d104a0df9bed.tar.gz
patch 7.4.2343v7.4.2343
Problem: Too many old file tests. Solution: Turn several into new style tests. (Yegappan Lakshmanan)
Diffstat (limited to 'src/testdir/test_hlsearch.vim')
-rw-r--r--src/testdir/test_hlsearch.vim34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/testdir/test_hlsearch.vim b/src/testdir/test_hlsearch.vim
new file mode 100644
index 000000000..066fdd025
--- /dev/null
+++ b/src/testdir/test_hlsearch.vim
@@ -0,0 +1,34 @@
+" Test for v:hlsearch
+
+function! Test_hlsearch()
+ new
+ call setline(1, repeat(['aaa'], 10))
+ set hlsearch nolazyredraw
+ let r=[]
+ " redraw is needed to make hlsearch highlight the matches
+ exe "normal! /aaa\<CR>" | redraw
+ let r1 = screenattr(1, 1)
+ nohlsearch | redraw
+ call assert_notequal(r1, screenattr(1,1))
+ let v:hlsearch=1 | redraw
+ call assert_equal(r1, screenattr(1,1))
+ let v:hlsearch=0 | redraw
+ call assert_notequal(r1, screenattr(1,1))
+ set hlsearch | redraw
+ call assert_equal(r1, screenattr(1,1))
+ let v:hlsearch=0 | redraw
+ call assert_notequal(r1, screenattr(1,1))
+ exe "normal! n" | redraw
+ call assert_equal(r1, screenattr(1,1))
+ let v:hlsearch=0 | redraw
+ call assert_notequal(r1, screenattr(1,1))
+ exe "normal! /\<CR>" | redraw
+ call assert_equal(r1, screenattr(1,1))
+ set nohls
+ exe "normal! /\<CR>" | redraw
+ call assert_notequal(r1, screenattr(1,1))
+ call assert_fails('let v:hlsearch=[]', 'E745')
+ call garbagecollect(1)
+ call getchar(1)
+ enew!
+endfunction