source check.vim
func Test_search_cmdline()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
" need to disable char_avail,
" so that expansion of commandline works
call test_override("char_avail", 1)
endfunc
func Test_search_cmdline2()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
" need to disable char_avail,
" so that expansion of commandline works
call test_override("char_avail", 1)
endfunc
func Test_search_cmdline3()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
call Cmdline3_prep()
1
" first match
endfunc
func Test_search_cmdline3s()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
call Cmdline3_prep()
1
call feedkeys(":%s/the\<c-l>/xxx\<cr>", 'tx')
endfunc
func Test_search_cmdline3g()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
call Cmdline3_prep()
1
call feedkeys(":g/the\<c-l>/d\<cr>", 'tx')
endfunc
func Test_search_cmdline3v()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
call Cmdline3_prep()
1
call feedkeys(":v/the\<c-l>/d\<cr>", 'tx')
endfunc
func Test_search_cmdline4()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
" need to disable char_avail,
" so that expansion of commandline works
call test_override("char_avail", 1)
endfunc
func Test_search_cmdline5()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
" Do not call test_override("char_avail", 1) so that <C-g> and <C-t> work
" regardless char_avail.
new
func Test_search_cmdline6()
" Test that consecutive matches
" are caught by <c-g>/<c-t>
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
" need to disable char_avail,
" so that expansion of commandline works
call test_override("char_avail", 1)
func Test_search_cmdline7()
" Test that an pressing <c-g> in an empty command line
" does not move the cursor
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
" need to disable char_avail,
" so that expansion of commandline works
call test_override("char_avail", 1)
endfunc
func Test_search_cmdline_incsearch_highlight()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
set incsearch hlsearch
" need to disable char_avail,
" so that expansion of commandline works
endfunc
func Test_incsearch_cmdline_modifier()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
call test_override("char_avail", 1)
new
call setline(1, ['foo'])
endfunc
func Test_incsearch_search_dump()
- if !exists('+incsearch')
- return
- endif
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckOption incsearch
+ CheckScreendump
+
call writefile([
\ 'set incsearch hlsearch scrolloff=0',
\ 'for n in range(1, 8)',
endfunc
func Test_incsearch_substitute()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
call test_override("char_avail", 1)
new
set incsearch
" Similar to Test_incsearch_substitute() but with a screendump halfway.
func Test_incsearch_substitute_dump()
- if !exists('+incsearch')
- return
- endif
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckOption incsearch
+ CheckScreendump
+
call writefile([
\ 'set incsearch hlsearch scrolloff=0',
\ 'for n in range(1, 10)',
endfunc
func Test_incsearch_highlighting()
- if !exists('+incsearch')
- return
- endif
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckOption incsearch
+ CheckScreendump
call writefile([
\ 'set incsearch hlsearch',
call term_sendkeys(buf, ":%s;ello/the")
call VerifyScreenDump(buf, 'Test_incsearch_substitute_15', {})
call term_sendkeys(buf, "<Esc>")
+
+ call StopVimInTerminal(buf)
+ call delete('Xis_subst_hl_script')
endfunc
func Test_incsearch_with_change()
- if !has('timers') || !exists('+incsearch') || !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps and/or timers feature and/or incsearch option missing'
- endif
+ CheckFeature timers
+ CheckOption incsearch
+ CheckScreendump
call writefile([
\ 'set incsearch hlsearch scrolloff=0',
" Similar to Test_incsearch_substitute_dump() for :sort
func Test_incsearch_sort_dump()
- if !exists('+incsearch')
- return
- endif
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckOption incsearch
+ CheckScreendump
+
call writefile([
\ 'set incsearch hlsearch scrolloff=0',
\ 'call setline(1, ["another one 2", "that one 3", "the one 1"])',
" Similar to Test_incsearch_substitute_dump() for :vimgrep famiry
func Test_incsearch_vimgrep_dump()
- if !exists('+incsearch')
- return
- endif
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckOption incsearch
+ CheckScreendump
+
call writefile([
\ 'set incsearch hlsearch scrolloff=0',
\ 'call setline(1, ["another one 2", "that one 3", "the one 1"])',
endfunc
func Test_keep_last_search_pattern()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
new
call setline(1, ['foo', 'foo', 'foo'])
set incsearch
endfunc
func Test_word_under_cursor_after_match()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
new
call setline(1, 'foo bar')
set incsearch
endfunc
func Test_subst_word_under_cursor()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
new
call setline(1, ['int SomeLongName;', 'for (xxx = 1; xxx < len; ++xxx)'])
set incsearch
endfunc
func Test_search_undefined_behaviour()
- if !has("terminal")
- return
- endif
+ CheckFeature terminal
+
let h = winheight(0)
if h < 3
return
" ' ̇' U+0307 Dec:775 COMBINING DOT ABOVE ̇ /\%u307\Z "\u0307"
" ' ̣' U+0323 Dec:803 COMBINING DOT BELOW ̣ /\%u323 "\u0323"
" Those should also appear on the commandline
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
call Cmdline3_prep()
1
let bufcontent = ['', 'Miạ̀́̇m']
endfunc
func Test_incsearch_add_char_under_cursor()
- if !exists('+incsearch')
- return
- endif
+ CheckOption incsearch
+
set incsearch
new
call setline(1, ['find match', 'anything'])