mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
Merge pull request #34744 from zeertzjq/test-override
test(old): emulate test_override('char_avail') using FFI
This commit is contained in:
@ -602,6 +602,16 @@ static int may_add_char_to_search(int firstc, int *c, incsearch_state_T *s)
|
|||||||
stuffcharReadbuff(*c);
|
stuffcharReadbuff(*c);
|
||||||
*c = '\\';
|
*c = '\\';
|
||||||
}
|
}
|
||||||
|
// add any composing characters
|
||||||
|
if (utf_char2len(*c) != utfc_ptr2len(get_cursor_pos_ptr())) {
|
||||||
|
const int save_c = *c;
|
||||||
|
while (utf_char2len(*c) != utfc_ptr2len(get_cursor_pos_ptr())) {
|
||||||
|
curwin->w_cursor.col += utf_char2len(*c);
|
||||||
|
*c = gchar_cursor();
|
||||||
|
stuffcharReadbuff(*c);
|
||||||
|
}
|
||||||
|
*c = save_c;
|
||||||
|
}
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1866,6 +1866,9 @@ int vpeekc_any(void)
|
|||||||
/// @return true if a character is available, false otherwise.
|
/// @return true if a character is available, false otherwise.
|
||||||
bool char_avail(void)
|
bool char_avail(void)
|
||||||
{
|
{
|
||||||
|
if (disable_char_avail_for_testing) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
no_mapping++;
|
no_mapping++;
|
||||||
int retval = vpeekc();
|
int retval = vpeekc();
|
||||||
no_mapping--;
|
no_mapping--;
|
||||||
|
@ -17,6 +17,8 @@ typedef enum {
|
|||||||
|
|
||||||
enum { NSCRIPT = 15, }; ///< Maximum number of streams to read script from
|
enum { NSCRIPT = 15, }; ///< Maximum number of streams to read script from
|
||||||
|
|
||||||
|
EXTERN bool disable_char_avail_for_testing INIT( = false);
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "getchar.h.generated.h"
|
# include "getchar.h.generated.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -166,6 +166,57 @@ endif
|
|||||||
" Prepare for calling test_garbagecollect_now().
|
" Prepare for calling test_garbagecollect_now().
|
||||||
let v:testing = 1
|
let v:testing = 1
|
||||||
|
|
||||||
|
let s:has_ffi = luaeval('pcall(require, "ffi")')
|
||||||
|
if s:has_ffi
|
||||||
|
lua << trim EOF
|
||||||
|
require('ffi').cdef([[
|
||||||
|
int starting;
|
||||||
|
bool disable_char_avail_for_testing;
|
||||||
|
]])
|
||||||
|
EOF
|
||||||
|
endif
|
||||||
|
|
||||||
|
" This can emulate test_override('starting') and test_override('char_avail')
|
||||||
|
" if LuaJIT FFI is enabled.
|
||||||
|
" Other flags are not supported.
|
||||||
|
func Ntest_override(name, val)
|
||||||
|
if a:name !=# 'starting' && a:name != 'char_avail' && a:name !=# 'ALL'
|
||||||
|
throw 'Unexpected use of Ntest_override()'
|
||||||
|
endif
|
||||||
|
if !s:has_ffi
|
||||||
|
throw 'Skipped: missing LuaJIT FFI'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if a:name ==# 'starting' || a:name ==# 'ALL'
|
||||||
|
if a:val
|
||||||
|
if !exists('s:save_starting')
|
||||||
|
let s:save_starting = luaeval('require("ffi").C.starting')
|
||||||
|
endif
|
||||||
|
lua require("ffi").C.starting = 0
|
||||||
|
elseif exists('s:save_starting')
|
||||||
|
exe 'lua require("ffi").C.starting =' s:save_starting
|
||||||
|
unlet s:save_starting
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if a:name ==# 'char_avail' || a:name ==# 'ALL'
|
||||||
|
exe 'lua require("ffi").C.disable_char_avail_for_testing =' a:val
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" roughly equivalent to test_setmouse() in Vim
|
||||||
|
func Ntest_setmouse(row, col)
|
||||||
|
call nvim_input_mouse('move', '', '', 0, a:row - 1, a:col - 1)
|
||||||
|
if state('m') == ''
|
||||||
|
call getchar(0)
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" roughly equivalent to term_wait() in Vim
|
||||||
|
func Nterm_wait(buf, time = 10)
|
||||||
|
execute $'sleep {a:time}m'
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Support function: get the alloc ID by name.
|
" Support function: get the alloc ID by name.
|
||||||
func GetAllocId(name)
|
func GetAllocId(name)
|
||||||
exe 'split ' . s:srcdir . '/alloc.h'
|
exe 'split ' . s:srcdir . '/alloc.h'
|
||||||
@ -277,6 +328,10 @@ func RunTheTest(test)
|
|||||||
call add(s:skipped, 'SKIPPED ' . a:test . ': ' . g:skipped_reason)
|
call add(s:skipped, 'SKIPPED ' . a:test . ': ' . g:skipped_reason)
|
||||||
let skipped = v:true
|
let skipped = v:true
|
||||||
endif
|
endif
|
||||||
|
elseif !s:has_ffi && execute('func ' .. a:test[:-3])->match("\n[ 0-9]*call Ntest_override(") >= 0
|
||||||
|
call add(s:messages, ' Skipped')
|
||||||
|
call add(s:skipped, 'SKIPPED ' . a:test . ': missing LuaJIT FFI' . )
|
||||||
|
let skipped = v:true
|
||||||
else
|
else
|
||||||
try
|
try
|
||||||
exe 'call ' . a:test
|
exe 'call ' . a:test
|
||||||
|
@ -72,44 +72,6 @@ autocmd! nvim.popupmenu
|
|||||||
" Undo the 'grepprg' and 'grepformat' setting in _defaults.lua.
|
" Undo the 'grepprg' and 'grepformat' setting in _defaults.lua.
|
||||||
set grepprg& grepformat&
|
set grepprg& grepformat&
|
||||||
|
|
||||||
let s:has_ffi = luaeval('pcall(require, "ffi")')
|
|
||||||
if s:has_ffi
|
|
||||||
lua require("ffi").cdef("int starting;")
|
|
||||||
endif
|
|
||||||
|
|
||||||
" This can emulate test_override('starting', val) if LuaJIT FFI is enabled.
|
|
||||||
" Other flags are not supported.
|
|
||||||
func Ntest_override(name, val)
|
|
||||||
if a:name !=# 'starting'
|
|
||||||
throw "Do not use Ntest_override() for this"
|
|
||||||
endif
|
|
||||||
if !s:has_ffi
|
|
||||||
throw 'Skipped: missing LuaJIT FFI'
|
|
||||||
endif
|
|
||||||
if a:val
|
|
||||||
if !exists('s:save_starting')
|
|
||||||
let s:save_starting = luaeval('require("ffi").C.starting')
|
|
||||||
endif
|
|
||||||
lua require("ffi").C.starting = 0
|
|
||||||
else
|
|
||||||
exe 'lua require("ffi").C.starting =' s:save_starting
|
|
||||||
unlet s:save_starting
|
|
||||||
endif
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" roughly equivalent to test_setmouse() in Vim
|
|
||||||
func Ntest_setmouse(row, col)
|
|
||||||
call nvim_input_mouse('move', '', '', 0, a:row - 1, a:col - 1)
|
|
||||||
if state('m') == ''
|
|
||||||
call getchar(0)
|
|
||||||
endif
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" roughly equivalent to term_wait() in Vim
|
|
||||||
func Nterm_wait(buf, time = 10)
|
|
||||||
execute $'sleep {a:time}m'
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" Prevent Nvim log from writing to stderr.
|
" Prevent Nvim log from writing to stderr.
|
||||||
let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log'
|
let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log'
|
||||||
|
|
||||||
|
@ -2659,10 +2659,9 @@ endfunc
|
|||||||
|
|
||||||
" Test TextChangedI and TextChangedP
|
" Test TextChangedI and TextChangedP
|
||||||
func Test_ChangedP()
|
func Test_ChangedP()
|
||||||
throw 'Skipped: use test/functional/autocmd/textchanged_spec.lua'
|
|
||||||
new
|
new
|
||||||
call setline(1, ['foo', 'bar', 'foobar'])
|
call setline(1, ['foo', 'bar', 'foobar'])
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
set complete=. completeopt=menuone
|
set complete=. completeopt=menuone
|
||||||
|
|
||||||
func! TextChangedAutocmd(char)
|
func! TextChangedAutocmd(char)
|
||||||
@ -2703,7 +2702,7 @@ func Test_ChangedP()
|
|||||||
" TODO: how should it handle completeopt=noinsert,noselect?
|
" TODO: how should it handle completeopt=noinsert,noselect?
|
||||||
|
|
||||||
" CleanUp
|
" CleanUp
|
||||||
call test_override("char_avail", 0)
|
call Ntest_override("char_avail", 0)
|
||||||
au! TextChanged
|
au! TextChanged
|
||||||
au! TextChangedI
|
au! TextChangedI
|
||||||
au! TextChangedP
|
au! TextChangedP
|
||||||
@ -2723,9 +2722,8 @@ func SetLineOne()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_TextChangedI_with_setline()
|
func Test_TextChangedI_with_setline()
|
||||||
throw 'Skipped: use test/functional/autocmd/textchanged_spec.lua'
|
|
||||||
new
|
new
|
||||||
call test_override('char_avail', 1)
|
call Ntest_override('char_avail', 1)
|
||||||
autocmd TextChangedI <buffer> call SetLineOne()
|
autocmd TextChangedI <buffer> call SetLineOne()
|
||||||
call feedkeys("i(\<CR>\<Esc>", 'tx')
|
call feedkeys("i(\<CR>\<Esc>", 'tx')
|
||||||
call assert_equal('(', getline(1))
|
call assert_equal('(', getline(1))
|
||||||
@ -2734,7 +2732,7 @@ func Test_TextChangedI_with_setline()
|
|||||||
call assert_equal('', getline(1))
|
call assert_equal('', getline(1))
|
||||||
call assert_equal('', getline(2))
|
call assert_equal('', getline(2))
|
||||||
|
|
||||||
call test_override('char_avail', 0)
|
call Ntest_override('char_avail', 0)
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@ -724,15 +724,14 @@ func Test_edit_CTRL_K()
|
|||||||
let v:testing = 0
|
let v:testing = 0
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
if exists('*test_override')
|
call Ntest_override("char_avail", 1)
|
||||||
call test_override("char_avail", 1)
|
set showcmd
|
||||||
set showcmd
|
%d
|
||||||
%d
|
call feedkeys("A\<c-k>a:\<esc>", 'tnix')
|
||||||
call feedkeys("A\<c-k>a:\<esc>", 'tnix')
|
call assert_equal(['ä'], getline(1, '$'))
|
||||||
call assert_equal(['ä'], getline(1, '$'))
|
call Ntest_override("char_avail", 0)
|
||||||
call test_override("char_avail", 0)
|
set noshowcmd
|
||||||
set noshowcmd
|
|
||||||
endif
|
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@ -764,9 +763,9 @@ func Test_edit_CTRL_L()
|
|||||||
call assert_equal(['one', 'two', 'three', 'three', "\<c-l>\<c-p>\<c-n>", '', ''], getline(1, '$'))
|
call assert_equal(['one', 'two', 'three', 'three', "\<c-l>\<c-p>\<c-n>", '', ''], getline(1, '$'))
|
||||||
set complete&
|
set complete&
|
||||||
%d
|
%d
|
||||||
if has("conceal") && has("syntax") && !has("nvim")
|
if has("conceal") && has("syntax")
|
||||||
call setline(1, ['foo', 'bar', 'foobar'])
|
call setline(1, ['foo', 'bar', 'foobar'])
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
set conceallevel=2 concealcursor=n
|
set conceallevel=2 concealcursor=n
|
||||||
syn on
|
syn on
|
||||||
syn match ErrorMsg "^bar"
|
syn match ErrorMsg "^bar"
|
||||||
@ -782,7 +781,7 @@ func Test_edit_CTRL_L()
|
|||||||
call assert_equal(['foo', 'bar ', 'foobar'], getline(1, '$'))
|
call assert_equal(['foo', 'bar ', 'foobar'], getline(1, '$'))
|
||||||
call assert_equal(1, g:change)
|
call assert_equal(1, g:change)
|
||||||
|
|
||||||
call test_override("char_avail", 0)
|
call Ntest_override("char_avail", 0)
|
||||||
call clearmatches()
|
call clearmatches()
|
||||||
syn off
|
syn off
|
||||||
au! TextChangedI
|
au! TextChangedI
|
||||||
@ -1157,7 +1156,7 @@ func Test_edit_CTRL_V()
|
|||||||
|
|
||||||
" force some redraws
|
" force some redraws
|
||||||
set showmode showcmd
|
set showmode showcmd
|
||||||
" call test_override('char_avail', 1)
|
call Ntest_override('char_avail', 1)
|
||||||
|
|
||||||
call feedkeys("A\<c-v>\<c-n>\<c-v>\<c-l>\<c-v>\<c-b>\<esc>", 'tnix')
|
call feedkeys("A\<c-v>\<c-n>\<c-v>\<c-l>\<c-v>\<c-b>\<esc>", 'tnix')
|
||||||
call assert_equal(["abc\x0e\x0c\x02"], getline(1, '$'))
|
call assert_equal(["abc\x0e\x0c\x02"], getline(1, '$'))
|
||||||
@ -1172,7 +1171,7 @@ func Test_edit_CTRL_V()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
set noshowmode showcmd
|
set noshowmode showcmd
|
||||||
" call test_override('char_avail', 0)
|
call Ntest_override('char_avail', 0)
|
||||||
|
|
||||||
" No modifiers should be applied to the char typed using i_CTRL-V_digit.
|
" No modifiers should be applied to the char typed using i_CTRL-V_digit.
|
||||||
call feedkeys(":append\<CR>\<C-V>76c\<C-V>76\<C-F2>\<C-V>u3c0j\<C-V>u3c0\<M-F3>\<CR>.\<CR>", 'tnix')
|
call feedkeys(":append\<CR>\<C-V>76c\<C-V>76\<C-F2>\<C-V>u3c0j\<C-V>u3c0\<M-F3>\<CR>.\<CR>", 'tnix')
|
||||||
|
@ -1004,7 +1004,6 @@ func Test_popup_complete_backwards_ctrl_p()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_complete_o_tab()
|
func Test_complete_o_tab()
|
||||||
CheckFunction test_override
|
|
||||||
let s:o_char_pressed = 0
|
let s:o_char_pressed = 0
|
||||||
|
|
||||||
fun! s:act_on_text_changed()
|
fun! s:act_on_text_changed()
|
||||||
@ -1022,12 +1021,12 @@ func Test_complete_o_tab()
|
|||||||
call setline(1, ['hoard', 'hoax', 'hoarse', ''])
|
call setline(1, ['hoard', 'hoax', 'hoarse', ''])
|
||||||
let l:expected = ['hoard', 'hoax', 'hoarse', 'hoax', 'hoax']
|
let l:expected = ['hoard', 'hoax', 'hoarse', 'hoax', 'hoax']
|
||||||
call cursor(4,1)
|
call cursor(4,1)
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
call feedkeys("Ahoa\<tab>\<tab>\<c-y>\<esc>", 'tx')
|
call feedkeys("Ahoa\<tab>\<tab>\<c-y>\<esc>", 'tx')
|
||||||
call feedkeys("oho\<tab>\<tab>\<c-y>\<esc>", 'tx')
|
call feedkeys("oho\<tab>\<tab>\<c-y>\<esc>", 'tx')
|
||||||
call assert_equal(l:expected, getline(1,'$'))
|
call assert_equal(l:expected, getline(1,'$'))
|
||||||
|
|
||||||
call test_override("char_avail", 0)
|
call Ntest_override("char_avail", 0)
|
||||||
bwipe!
|
bwipe!
|
||||||
set completeopt&
|
set completeopt&
|
||||||
delfunc s:act_on_text_changed
|
delfunc s:act_on_text_changed
|
||||||
|
@ -3096,16 +3096,15 @@ endfunc
|
|||||||
" Test for incsearch highlighting of the :vimgrep pattern
|
" Test for incsearch highlighting of the :vimgrep pattern
|
||||||
" This test used to cause "E315: ml_get: invalid lnum" errors.
|
" This test used to cause "E315: ml_get: invalid lnum" errors.
|
||||||
func Test_vimgrep_incsearch()
|
func Test_vimgrep_incsearch()
|
||||||
CheckFunction test_override
|
|
||||||
enew
|
enew
|
||||||
set incsearch
|
set incsearch
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
|
|
||||||
call feedkeys(":2vimgrep assert test_quickfix.vim test_cdo.vim\<CR>", "ntx")
|
call feedkeys(":2vimgrep assert test_quickfix.vim test_cdo.vim\<CR>", "ntx")
|
||||||
let l = getqflist()
|
let l = getqflist()
|
||||||
call assert_equal(2, len(l))
|
call assert_equal(2, len(l))
|
||||||
|
|
||||||
call test_override("ALL", 0)
|
call Ntest_override("ALL", 0)
|
||||||
set noincsearch
|
set noincsearch
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@ -4,14 +4,12 @@ source shared.vim
|
|||||||
source screendump.vim
|
source screendump.vim
|
||||||
source check.vim
|
source check.vim
|
||||||
|
|
||||||
" See test/functional/legacy/search_spec.lua
|
|
||||||
func Test_search_cmdline()
|
func Test_search_cmdline()
|
||||||
CheckFunction test_override
|
|
||||||
CheckOption incsearch
|
CheckOption incsearch
|
||||||
|
|
||||||
" need to disable char_avail,
|
" need to disable char_avail,
|
||||||
" so that expansion of commandline works
|
" so that expansion of commandline works
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
new
|
new
|
||||||
call setline(1, [' 1', ' 2 these', ' 3 the', ' 4 their', ' 5 there', ' 6 their', ' 7 the', ' 8 them', ' 9 these', ' 10 foobar'])
|
call setline(1, [' 1', ' 2 these', ' 3 the', ' 4 their', ' 5 there', ' 6 their', ' 7 the', ' 8 them', ' 9 these', ' 10 foobar'])
|
||||||
" Test 1
|
" Test 1
|
||||||
@ -198,18 +196,16 @@ func Test_search_cmdline()
|
|||||||
call assert_equal(' 3 the', getline('.'))
|
call assert_equal(' 3 the', getline('.'))
|
||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
call test_override("char_avail", 0)
|
call Ntest_override("char_avail", 0)
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" See test/functional/legacy/search_spec.lua
|
|
||||||
func Test_search_cmdline2()
|
func Test_search_cmdline2()
|
||||||
CheckFunction test_override
|
|
||||||
CheckOption incsearch
|
CheckOption incsearch
|
||||||
|
|
||||||
" need to disable char_avail,
|
" need to disable char_avail,
|
||||||
" so that expansion of commandline works
|
" so that expansion of commandline works
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
new
|
new
|
||||||
call setline(1, [' 1', ' 2 these', ' 3 the theother'])
|
call setline(1, [' 1', ' 2 these', ' 3 the theother'])
|
||||||
" Test 1
|
" Test 1
|
||||||
@ -275,7 +271,7 @@ func Test_search_cmdline2()
|
|||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
set noincsearch
|
set noincsearch
|
||||||
call test_override("char_avail", 0)
|
call Ntest_override("char_avail", 0)
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@ -434,19 +430,17 @@ func Test_searchc()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Cmdline3_prep()
|
func Cmdline3_prep()
|
||||||
CheckFunction test_override
|
|
||||||
" need to disable char_avail,
|
" need to disable char_avail,
|
||||||
" so that expansion of commandline works
|
" so that expansion of commandline works
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
new
|
new
|
||||||
call setline(1, [' 1', ' 2 the~e', ' 3 the theother'])
|
call setline(1, [' 1', ' 2 the~e', ' 3 the theother'])
|
||||||
set incsearch
|
set incsearch
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Incsearch_cleanup()
|
func Incsearch_cleanup()
|
||||||
CheckFunction test_override
|
|
||||||
set noincsearch
|
set noincsearch
|
||||||
call test_override("char_avail", 0)
|
call Ntest_override("char_avail", 0)
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@ -525,14 +519,12 @@ func Test_search_cmdline3v()
|
|||||||
call Incsearch_cleanup()
|
call Incsearch_cleanup()
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" See test/functional/legacy/search_spec.lua
|
|
||||||
func Test_search_cmdline4()
|
func Test_search_cmdline4()
|
||||||
CheckFunction test_override
|
|
||||||
CheckOption incsearch
|
CheckOption incsearch
|
||||||
|
|
||||||
" need to disable char_avail,
|
" need to disable char_avail,
|
||||||
" so that expansion of commandline works
|
" so that expansion of commandline works
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
new
|
new
|
||||||
call setline(1, [' 1 the first', ' 2 the second', ' 3 the third'])
|
call setline(1, [' 1 the first', ' 2 the second', ' 3 the third'])
|
||||||
set incsearch
|
set incsearch
|
||||||
@ -556,7 +548,7 @@ func Test_search_cmdline4()
|
|||||||
call assert_equal(' 2 the second', getline('.'))
|
call assert_equal(' 2 the second', getline('.'))
|
||||||
" clean up
|
" clean up
|
||||||
set noincsearch
|
set noincsearch
|
||||||
call test_override("char_avail", 0)
|
call Ntest_override("char_avail", 0)
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@ -582,12 +574,11 @@ endfunc
|
|||||||
func Test_search_cmdline6()
|
func Test_search_cmdline6()
|
||||||
" Test that consecutive matches
|
" Test that consecutive matches
|
||||||
" are caught by <c-g>/<c-t>
|
" are caught by <c-g>/<c-t>
|
||||||
CheckFunction test_override
|
|
||||||
CheckOption incsearch
|
CheckOption incsearch
|
||||||
|
|
||||||
" need to disable char_avail,
|
" need to disable char_avail,
|
||||||
" so that expansion of commandline works
|
" so that expansion of commandline works
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
new
|
new
|
||||||
call setline(1, [' bbvimb', ''])
|
call setline(1, [' bbvimb', ''])
|
||||||
set incsearch
|
set incsearch
|
||||||
@ -615,12 +606,11 @@ func Test_search_cmdline6()
|
|||||||
" clean up
|
" clean up
|
||||||
set wrapscan&vim
|
set wrapscan&vim
|
||||||
set noincsearch
|
set noincsearch
|
||||||
call test_override("char_avail", 0)
|
call Ntest_override("char_avail", 0)
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_search_cmdline7()
|
func Test_search_cmdline7()
|
||||||
CheckFunction test_override
|
|
||||||
" Test that pressing <c-g> in an empty command line
|
" Test that pressing <c-g> in an empty command line
|
||||||
" does not move the cursor
|
" does not move the cursor
|
||||||
if !exists('+incsearch')
|
if !exists('+incsearch')
|
||||||
@ -628,7 +618,7 @@ func Test_search_cmdline7()
|
|||||||
endif
|
endif
|
||||||
" need to disable char_avail,
|
" need to disable char_avail,
|
||||||
" so that expansion of commandline works
|
" so that expansion of commandline works
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
new
|
new
|
||||||
let @/ = 'b'
|
let @/ = 'b'
|
||||||
call setline(1, [' bbvimb', ''])
|
call setline(1, [' bbvimb', ''])
|
||||||
@ -654,7 +644,7 @@ func Test_search_cmdline7()
|
|||||||
call assert_equal(4, col('.'))
|
call assert_equal(4, col('.'))
|
||||||
|
|
||||||
set noincsearch
|
set noincsearch
|
||||||
call test_override("char_avail", 0)
|
call Ntest_override("char_avail", 0)
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@ -765,13 +755,12 @@ func Test_search_regexp()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_search_cmdline_incsearch_highlight()
|
func Test_search_cmdline_incsearch_highlight()
|
||||||
CheckFunction test_override
|
|
||||||
CheckOption incsearch
|
CheckOption incsearch
|
||||||
|
|
||||||
set incsearch hlsearch
|
set incsearch hlsearch
|
||||||
" need to disable char_avail,
|
" need to disable char_avail,
|
||||||
" so that expansion of commandline works
|
" so that expansion of commandline works
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
new
|
new
|
||||||
call setline(1, ['aaa 1 the first', ' 2 the second', ' 3 the third'])
|
call setline(1, ['aaa 1 the first', ' 2 the second', ' 3 the third'])
|
||||||
|
|
||||||
@ -794,7 +783,7 @@ func Test_search_cmdline_incsearch_highlight()
|
|||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
set noincsearch nohlsearch
|
set noincsearch nohlsearch
|
||||||
call test_override("char_avail", 0)
|
call Ntest_override("char_avail", 0)
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@ -884,10 +873,9 @@ func Test_search_cmdline_incsearch_highlight_attr()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_incsearch_cmdline_modifier()
|
func Test_incsearch_cmdline_modifier()
|
||||||
CheckFunction test_override
|
|
||||||
CheckOption incsearch
|
CheckOption incsearch
|
||||||
|
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
new
|
new
|
||||||
call setline(1, ['foo'])
|
call setline(1, ['foo'])
|
||||||
set incsearch
|
set incsearch
|
||||||
@ -1011,10 +999,9 @@ func Test_hlsearch_block_visual_match()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_incsearch_substitute()
|
func Test_incsearch_substitute()
|
||||||
CheckFunction test_override
|
|
||||||
CheckOption incsearch
|
CheckOption incsearch
|
||||||
|
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
new
|
new
|
||||||
set incsearch
|
set incsearch
|
||||||
for n in range(1, 10)
|
for n in range(1, 10)
|
||||||
@ -1032,9 +1019,8 @@ func Test_incsearch_substitute()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_incsearch_substitute_long_line()
|
func Test_incsearch_substitute_long_line()
|
||||||
CheckFunction test_override
|
|
||||||
new
|
new
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
set incsearch
|
set incsearch
|
||||||
|
|
||||||
call repeat('x', 100000)->setline(1)
|
call repeat('x', 100000)->setline(1)
|
||||||
@ -1313,13 +1299,12 @@ func Test_incsearch_vimgrep_dump()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_keep_last_search_pattern()
|
func Test_keep_last_search_pattern()
|
||||||
CheckFunction test_override
|
|
||||||
CheckOption incsearch
|
CheckOption incsearch
|
||||||
|
|
||||||
new
|
new
|
||||||
call setline(1, ['foo', 'foo', 'foo'])
|
call setline(1, ['foo', 'foo', 'foo'])
|
||||||
set incsearch
|
set incsearch
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
let @/ = 'bar'
|
let @/ = 'bar'
|
||||||
call feedkeys(":/foo/s//\<Esc>", 'ntx')
|
call feedkeys(":/foo/s//\<Esc>", 'ntx')
|
||||||
call assert_equal('bar', @/)
|
call assert_equal('bar', @/)
|
||||||
@ -1329,18 +1314,17 @@ func Test_keep_last_search_pattern()
|
|||||||
call assert_equal('bar', @/)
|
call assert_equal('bar', @/)
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
call test_override("ALL", 0)
|
call Ntest_override("ALL", 0)
|
||||||
set noincsearch
|
set noincsearch
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_word_under_cursor_after_match()
|
func Test_word_under_cursor_after_match()
|
||||||
CheckFunction test_override
|
|
||||||
CheckOption incsearch
|
CheckOption incsearch
|
||||||
|
|
||||||
new
|
new
|
||||||
call setline(1, 'foo bar')
|
call setline(1, 'foo bar')
|
||||||
set incsearch
|
set incsearch
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
try
|
try
|
||||||
call feedkeys("/foo\<C-R>\<C-W>\<CR>", 'ntx')
|
call feedkeys("/foo\<C-R>\<C-W>\<CR>", 'ntx')
|
||||||
catch /E486:/
|
catch /E486:/
|
||||||
@ -1348,24 +1332,23 @@ func Test_word_under_cursor_after_match()
|
|||||||
call assert_equal('foobar', @/)
|
call assert_equal('foobar', @/)
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
call test_override("ALL", 0)
|
call Ntest_override("ALL", 0)
|
||||||
set noincsearch
|
set noincsearch
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_subst_word_under_cursor()
|
func Test_subst_word_under_cursor()
|
||||||
CheckFunction test_override
|
|
||||||
CheckOption incsearch
|
CheckOption incsearch
|
||||||
|
|
||||||
new
|
new
|
||||||
call setline(1, ['int SomeLongName;', 'for (xxx = 1; xxx < len; ++xxx)'])
|
call setline(1, ['int SomeLongName;', 'for (xxx = 1; xxx < len; ++xxx)'])
|
||||||
set incsearch
|
set incsearch
|
||||||
call test_override("char_avail", 1)
|
call Ntest_override("char_avail", 1)
|
||||||
call feedkeys("/LongName\<CR>", 'ntx')
|
call feedkeys("/LongName\<CR>", 'ntx')
|
||||||
call feedkeys(":%s/xxx/\<C-R>\<C-W>/g\<CR>", 'ntx')
|
call feedkeys(":%s/xxx/\<C-R>\<C-W>/g\<CR>", 'ntx')
|
||||||
call assert_equal('for (SomeLongName = 1; SomeLongName < len; ++SomeLongName)', getline(2))
|
call assert_equal('for (SomeLongName = 1; SomeLongName < len; ++SomeLongName)', getline(2))
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
call test_override("ALL", 0)
|
call Ntest_override("ALL", 0)
|
||||||
set noincsearch
|
set noincsearch
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@ -1546,17 +1529,16 @@ func Test_one_error_msg()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_incsearch_add_char_under_cursor()
|
func Test_incsearch_add_char_under_cursor()
|
||||||
CheckFunction test_override
|
|
||||||
CheckOption incsearch
|
CheckOption incsearch
|
||||||
|
|
||||||
set incsearch
|
set incsearch
|
||||||
new
|
new
|
||||||
call setline(1, ['find match', 'anything'])
|
call setline(1, ['find match', 'anything'])
|
||||||
1
|
1
|
||||||
call test_override('char_avail', 1)
|
call Ntest_override('char_avail', 1)
|
||||||
call feedkeys("fc/m\<C-L>\<C-L>\<C-L>\<C-L>\<C-L>\<CR>", 'tx')
|
call feedkeys("fc/m\<C-L>\<C-L>\<C-L>\<C-L>\<C-L>\<CR>", 'tx')
|
||||||
call assert_equal('match', @/)
|
call assert_equal('match', @/)
|
||||||
call test_override('char_avail', 0)
|
call Ntest_override('char_avail', 0)
|
||||||
|
|
||||||
set incsearch&
|
set incsearch&
|
||||||
bwipe!
|
bwipe!
|
||||||
|
Reference in New Issue
Block a user