mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.0615: regexp benchmark stest is old style
Problem: Regexp benchmark stest is old style. Solution: Make it a new style test. Fix using a NULL list. Add more tests. (Yegappan Lakshmanan, closes #5963)
This commit is contained in:
@@ -176,6 +176,13 @@ set_buffer_lines(
|
|||||||
if (lines->v_type == VAR_LIST)
|
if (lines->v_type == VAR_LIST)
|
||||||
{
|
{
|
||||||
l = lines->vval.v_list;
|
l = lines->vval.v_list;
|
||||||
|
if (l == NULL || list_len(l) == 0)
|
||||||
|
{
|
||||||
|
// set proper return code
|
||||||
|
if (lnum > curbuf->b_ml.ml_line_count)
|
||||||
|
rettv->vval.v_number = 1; // FAIL
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
range_list_materialize(l);
|
range_list_materialize(l);
|
||||||
li = l->lv_first;
|
li = l->lv_first;
|
||||||
}
|
}
|
||||||
@@ -251,6 +258,7 @@ set_buffer_lines(
|
|||||||
update_topline();
|
update_topline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
if (!is_curbuf)
|
if (!is_curbuf)
|
||||||
{
|
{
|
||||||
curbuf = curbuf_save;
|
curbuf = curbuf_save;
|
||||||
|
@@ -107,12 +107,13 @@ nolog:
|
|||||||
-if exist test_result.log del test_result.log
|
-if exist test_result.log del test_result.log
|
||||||
-if exist messages del messages
|
-if exist messages del messages
|
||||||
|
|
||||||
benchmark:
|
benchmark: test_bench_regexp.res
|
||||||
bench_re_freeze.out
|
|
||||||
|
|
||||||
bench_re_freeze.out: bench_re_freeze.vim
|
test_bench_regexp.res: test_bench_regexp.vim
|
||||||
-if exist benchmark.out del benchmark.out
|
-if exist benchmark.out del benchmark.out
|
||||||
$(VIMPROG) -u dos.vim $(NO_INITS) $*.in
|
@echo $(VIMPROG) > vimcmd
|
||||||
|
$(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
|
||||||
|
@del vimcmd
|
||||||
@IF EXIST benchmark.out ( type benchmark.out )
|
@IF EXIST benchmark.out ( type benchmark.out )
|
||||||
|
|
||||||
# New style of tests uses Vim script with assert calls. These are easier
|
# New style of tests uses Vim script with assert calls. These are easier
|
||||||
|
@@ -35,7 +35,7 @@ include Make_all.mak
|
|||||||
|
|
||||||
SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) $(SCRIPTS_WIN32)
|
SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) $(SCRIPTS_WIN32)
|
||||||
|
|
||||||
SCRIPTS_BENCH = bench_re_freeze.out
|
SCRIPTS_BENCH = test_bench_regexp.res
|
||||||
|
|
||||||
# Must run test1 first to create small.vim.
|
# Must run test1 first to create small.vim.
|
||||||
$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS_RES): $(SCRIPTS_FIRST)
|
$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS_RES): $(SCRIPTS_FIRST)
|
||||||
@@ -110,9 +110,11 @@ nolog:
|
|||||||
-@if exist test.log $(DEL) test.log
|
-@if exist test.log $(DEL) test.log
|
||||||
-@if exist messages $(DEL) messages
|
-@if exist messages $(DEL) messages
|
||||||
|
|
||||||
bench_re_freeze.out: bench_re_freeze.vim
|
test_bench_regexp.res: test_bench_regexp.vim
|
||||||
-$(DEL) benchmark.out
|
-$(DEL) benchmark.out
|
||||||
$(VIMPROG) -u dos.vim $(NO_INITS) $*.in
|
@echo $(VIMPROG) > vimcmd
|
||||||
|
$(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
|
||||||
|
@$(DEL) vimcmd
|
||||||
$(CAT) benchmark.out
|
$(CAT) benchmark.out
|
||||||
|
|
||||||
# New style of tests uses Vim script with assert calls. These are easier
|
# New style of tests uses Vim script with assert calls. These are easier
|
||||||
|
@@ -38,7 +38,7 @@ test49.out: test49.vim
|
|||||||
|
|
||||||
test_options.res test_alot.res: opt_test.vim
|
test_options.res test_alot.res: opt_test.vim
|
||||||
|
|
||||||
SCRIPTS_BENCH = bench_re_freeze.out
|
SCRIPTS_BENCH = test_bench_regexp.res
|
||||||
|
|
||||||
.SUFFIXES: .in .out .res .vim
|
.SUFFIXES: .in .out .res .vim
|
||||||
|
|
||||||
@@ -146,15 +146,6 @@ test1.out: test1.in
|
|||||||
fi"
|
fi"
|
||||||
-rm -rf X* test.ok viminfo
|
-rm -rf X* test.ok viminfo
|
||||||
|
|
||||||
bench_re_freeze.out: bench_re_freeze.vim
|
|
||||||
-rm -rf benchmark.out $(RM_ON_RUN)
|
|
||||||
# Sleep a moment to avoid that the xterm title is messed up.
|
|
||||||
# 200 msec is sufficient, but only modern sleep supports a fraction of
|
|
||||||
# a second, fall back to a second if it fails.
|
|
||||||
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
|
|
||||||
$(RUN_VIM) $*.in $(REDIR_TEST_TO_NULL)
|
|
||||||
@/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi"
|
|
||||||
|
|
||||||
nolog:
|
nolog:
|
||||||
-rm -f test.log messages
|
-rm -f test.log messages
|
||||||
|
|
||||||
@@ -193,3 +184,12 @@ opt_test.vim: ../optiondefs.h gen_opt_test.vim
|
|||||||
|
|
||||||
test_xxd.res:
|
test_xxd.res:
|
||||||
XXD=$(XXDPROG); export XXD; $(RUN_VIMTEST) $(NO_INITS) -S runtest.vim test_xxd.vim
|
XXD=$(XXDPROG); export XXD; $(RUN_VIMTEST) $(NO_INITS) -S runtest.vim test_xxd.vim
|
||||||
|
|
||||||
|
test_bench_regexp.res: test_bench_regexp.vim
|
||||||
|
-rm -rf benchmark.out $(RM_ON_RUN)
|
||||||
|
# Sleep a moment to avoid that the xterm title is messed up.
|
||||||
|
# 200 msec is sufficient, but only modern sleep supports a fraction of
|
||||||
|
# a second, fall back to a second if it fails.
|
||||||
|
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
|
||||||
|
$(RUN_VIMTEST) $(NO_INITS) -S runtest.vim $*.vim $(REDIR_TEST_TO_NULL)
|
||||||
|
@/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi"
|
||||||
|
@@ -1,13 +0,0 @@
|
|||||||
Test for Benchmarking RE engine
|
|
||||||
|
|
||||||
STARTTEST
|
|
||||||
:so small.vim
|
|
||||||
:if !has("reltime") | qa! | endif
|
|
||||||
:set nocp cpo&vim
|
|
||||||
:so bench_re_freeze.vim
|
|
||||||
:call Measure('samples/re.freeze.txt', '\s\+\%#\@<!$', '+5')
|
|
||||||
:/^" Benchmark/,$w! benchmark.out
|
|
||||||
:qa!
|
|
||||||
ENDTEST
|
|
||||||
|
|
||||||
" Benchmark_results:
|
|
@@ -1,13 +0,0 @@
|
|||||||
"Test for benchmarking the RE engine
|
|
||||||
|
|
||||||
so small.vim
|
|
||||||
if !has("reltime") | finish | endif
|
|
||||||
func! Measure(file, pattern, arg)
|
|
||||||
for re in range(3)
|
|
||||||
let sstart=reltime()
|
|
||||||
let cmd=printf("../vim -u NONE -N --cmd ':set re=%d'".
|
|
||||||
\ " -c 'call search(\"%s\", \"\", \"\", 10000)' -c ':q!' %s", re, escape(a:pattern, '\\'), empty(a:arg) ? '' : a:arg)
|
|
||||||
call system(cmd. ' '. a:file)
|
|
||||||
$put =printf('file: %s, re: %d, time: %s', a:file, re, reltimestr(reltime(sstart)))
|
|
||||||
endfor
|
|
||||||
endfunc
|
|
@@ -299,6 +299,8 @@ func Test_augroup_warning()
|
|||||||
redir END
|
redir END
|
||||||
call assert_true(match(res, "W19:") < 0)
|
call assert_true(match(res, "W19:") < 0)
|
||||||
au! VimEnter
|
au! VimEnter
|
||||||
|
|
||||||
|
call assert_fails('augroup!', 'E471:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_BufReadCmdHelp()
|
func Test_BufReadCmdHelp()
|
||||||
|
24
src/testdir/test_bench_regexp.vim
Normal file
24
src/testdir/test_bench_regexp.vim
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
" Test for benchmarking the RE engine
|
||||||
|
|
||||||
|
source check.vim
|
||||||
|
CheckFeature reltime
|
||||||
|
|
||||||
|
func Measure(file, pattern, arg)
|
||||||
|
for re in range(3)
|
||||||
|
let sstart = reltime()
|
||||||
|
let before = ['set re=' .. re]
|
||||||
|
let after = ['call search("' .. escape(a:pattern, '\\') .. '", "", "", 10000)']
|
||||||
|
let after += ['quit!']
|
||||||
|
let args = empty(a:arg) ? '' : a:arg .. ' ' .. a:file
|
||||||
|
call RunVim(before, after, args)
|
||||||
|
let s = 'file: ' .. a:file .. ', re: ' .. re ..
|
||||||
|
\ ', time: ' .. reltimestr(reltime(sstart))
|
||||||
|
call writefile([s], 'benchmark.out', "a")
|
||||||
|
endfor
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_Regex_Benchmark()
|
||||||
|
call Measure('samples/re.freeze.txt', '\s\+\%#\@<!$', '+5')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" vim: shiftwidth=2 sts=2 expandtab
|
@@ -291,6 +291,7 @@ func Test_blob_index()
|
|||||||
call assert_equal(3, index(0z11110111, 0x11, -2))
|
call assert_equal(3, index(0z11110111, 0x11, -2))
|
||||||
call assert_equal(0, index(0z11110111, 0x11, -10))
|
call assert_equal(0, index(0z11110111, 0x11, -10))
|
||||||
call assert_fails("echo index(0z11110111, 0x11, [])", 'E745:')
|
call assert_fails("echo index(0z11110111, 0x11, [])", 'E745:')
|
||||||
|
call assert_equal(-1, index(test_null_blob(), 1))
|
||||||
|
|
||||||
call assert_fails('call index("asdf", 0)', 'E897:')
|
call assert_fails('call index("asdf", 0)', 'E897:')
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -19,8 +19,19 @@ func Test_setbufline_getbufline()
|
|||||||
call setline(1, ['a', 'b', 'c'])
|
call setline(1, ['a', 'b', 'c'])
|
||||||
let b = bufnr('%')
|
let b = bufnr('%')
|
||||||
wincmd w
|
wincmd w
|
||||||
|
|
||||||
|
call assert_equal(1, setbufline(b, 5, 'x'))
|
||||||
call assert_equal(1, setbufline(b, 5, ['x']))
|
call assert_equal(1, setbufline(b, 5, ['x']))
|
||||||
|
call assert_equal(1, setbufline(b, 5, []))
|
||||||
|
call assert_equal(1, setbufline(b, 5, test_null_list()))
|
||||||
|
|
||||||
|
call assert_equal(1, 'x'->setbufline(bufnr('$') + 1, 1))
|
||||||
call assert_equal(1, ['x']->setbufline(bufnr('$') + 1, 1))
|
call assert_equal(1, ['x']->setbufline(bufnr('$') + 1, 1))
|
||||||
|
call assert_equal(1, []->setbufline(bufnr('$') + 1, 1))
|
||||||
|
call assert_equal(1, test_null_list()->setbufline(bufnr('$') + 1, 1))
|
||||||
|
|
||||||
|
call assert_equal(['a', 'b', 'c'], getbufline(b, 1, '$'))
|
||||||
|
|
||||||
call assert_equal(0, setbufline(b, 4, ['d', 'e']))
|
call assert_equal(0, setbufline(b, 4, ['d', 'e']))
|
||||||
call assert_equal(['c'], b->getbufline(3))
|
call assert_equal(['c'], b->getbufline(3))
|
||||||
call assert_equal(['d'], getbufline(b, 4))
|
call assert_equal(['d'], getbufline(b, 4))
|
||||||
@@ -83,9 +94,29 @@ func Test_appendbufline()
|
|||||||
call setline(1, ['a', 'b', 'c'])
|
call setline(1, ['a', 'b', 'c'])
|
||||||
let b = bufnr('%')
|
let b = bufnr('%')
|
||||||
wincmd w
|
wincmd w
|
||||||
|
|
||||||
|
call assert_equal(1, appendbufline(b, -1, 'x'))
|
||||||
call assert_equal(1, appendbufline(b, -1, ['x']))
|
call assert_equal(1, appendbufline(b, -1, ['x']))
|
||||||
|
call assert_equal(1, appendbufline(b, -1, []))
|
||||||
|
call assert_equal(1, appendbufline(b, -1, test_null_list()))
|
||||||
|
|
||||||
|
call assert_equal(1, appendbufline(b, 4, 'x'))
|
||||||
call assert_equal(1, appendbufline(b, 4, ['x']))
|
call assert_equal(1, appendbufline(b, 4, ['x']))
|
||||||
|
call assert_equal(1, appendbufline(b, 4, []))
|
||||||
|
call assert_equal(1, appendbufline(b, 4, test_null_list()))
|
||||||
|
|
||||||
|
call assert_equal(1, appendbufline(1234, 1, 'x'))
|
||||||
call assert_equal(1, appendbufline(1234, 1, ['x']))
|
call assert_equal(1, appendbufline(1234, 1, ['x']))
|
||||||
|
call assert_equal(1, appendbufline(1234, 1, []))
|
||||||
|
call assert_equal(1, appendbufline(1234, 1, test_null_list()))
|
||||||
|
|
||||||
|
call assert_equal(0, appendbufline(b, 1, []))
|
||||||
|
call assert_equal(0, appendbufline(b, 1, test_null_list()))
|
||||||
|
call assert_equal(1, appendbufline(b, 3, []))
|
||||||
|
call assert_equal(1, appendbufline(b, 3, test_null_list()))
|
||||||
|
|
||||||
|
call assert_equal(['a', 'b', 'c'], getbufline(b, 1, '$'))
|
||||||
|
|
||||||
call assert_equal(0, appendbufline(b, 3, ['d', 'e']))
|
call assert_equal(0, appendbufline(b, 3, ['d', 'e']))
|
||||||
call assert_equal(['c'], getbufline(b, 3))
|
call assert_equal(['c'], getbufline(b, 3))
|
||||||
call assert_equal(['d'], getbufline(b, 4))
|
call assert_equal(['d'], getbufline(b, 4))
|
||||||
|
@@ -167,6 +167,8 @@ func Ch_communicate(port)
|
|||||||
call ch_setoptions(handle, {'drop': 'never'})
|
call ch_setoptions(handle, {'drop': 'never'})
|
||||||
call ch_setoptions(handle, {'drop': 'auto'})
|
call ch_setoptions(handle, {'drop': 'auto'})
|
||||||
call assert_fails("call ch_setoptions(handle, {'drop': 'bad'})", "E475")
|
call assert_fails("call ch_setoptions(handle, {'drop': 'bad'})", "E475")
|
||||||
|
call assert_equal(0, ch_setoptions(handle, test_null_dict()))
|
||||||
|
call assert_equal(0, ch_setoptions(test_null_channel(), {'drop' : 'never'}))
|
||||||
|
|
||||||
" Send an eval request that works.
|
" Send an eval request that works.
|
||||||
call assert_equal('ok', ch_evalexpr(handle, 'eval-works'))
|
call assert_equal('ok', ch_evalexpr(handle, 'eval-works'))
|
||||||
@@ -1682,6 +1684,7 @@ func Test_job_start_fails()
|
|||||||
call assert_fails('let job = job_start("")', 'E474:')
|
call assert_fails('let job = job_start("")', 'E474:')
|
||||||
call assert_fails('let job = job_start(" ")', 'E474:')
|
call assert_fails('let job = job_start(" ")', 'E474:')
|
||||||
call assert_fails('let job = job_start(["ls", []])', 'E730:')
|
call assert_fails('let job = job_start(["ls", []])', 'E730:')
|
||||||
|
call assert_fails('call job_setoptions(test_null_job(), {})', 'E916:')
|
||||||
%bw!
|
%bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -2267,6 +2270,7 @@ func Test_invalid_job_chan_options()
|
|||||||
for opt in invalid_opts
|
for opt in invalid_opts
|
||||||
call assert_fails("let x = ch_status(ch, opt)", 'E475:')
|
call assert_fails("let x = ch_status(ch, opt)", 'E475:')
|
||||||
endfor
|
endfor
|
||||||
|
call assert_equal('fail', ch_status(ch, test_null_dict()))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for passing the command and the arguments as List on MS-Windows
|
" Test for passing the command and the arguments as List on MS-Windows
|
||||||
|
@@ -934,6 +934,9 @@ func Test_verbosefile()
|
|||||||
let log = readfile('Xlog')
|
let log = readfile('Xlog')
|
||||||
call assert_match("foo\nbar", join(log, "\n"))
|
call assert_match("foo\nbar", join(log, "\n"))
|
||||||
call delete('Xlog')
|
call delete('Xlog')
|
||||||
|
call mkdir('Xdir')
|
||||||
|
call assert_fails('set verbosefile=Xdir', 'E474:')
|
||||||
|
call delete('Xdir', 'd')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_verbose_option()
|
func Test_verbose_option()
|
||||||
|
@@ -794,18 +794,41 @@ func Test_mode()
|
|||||||
set complete&
|
set complete&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Test for append()
|
||||||
func Test_append()
|
func Test_append()
|
||||||
enew!
|
enew!
|
||||||
split
|
split
|
||||||
call append(0, ["foo"])
|
call append(0, ["foo"])
|
||||||
|
call append(1, [])
|
||||||
|
call append(1, test_null_list())
|
||||||
|
call assert_equal(['foo', ''], getline(1, '$'))
|
||||||
split
|
split
|
||||||
only
|
only
|
||||||
undo
|
undo
|
||||||
|
undo
|
||||||
|
|
||||||
" Using $ instead of '$' must give an error
|
" Using $ instead of '$' must give an error
|
||||||
call assert_fails("call append($, 'foobar')", 'E116:')
|
call assert_fails("call append($, 'foobar')", 'E116:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Test for setline()
|
||||||
|
func Test_setline()
|
||||||
|
new
|
||||||
|
call setline(0, ["foo"])
|
||||||
|
call setline(0, [])
|
||||||
|
call setline(0, test_null_list())
|
||||||
|
call setline(1, ["bar"])
|
||||||
|
call setline(1, [])
|
||||||
|
call setline(1, test_null_list())
|
||||||
|
call setline(2, [])
|
||||||
|
call setline(2, test_null_list())
|
||||||
|
call setline(3, [])
|
||||||
|
call setline(3, test_null_list())
|
||||||
|
call setline(2, ["baz"])
|
||||||
|
call assert_equal(['bar', 'baz'], getline(1, '$'))
|
||||||
|
close!
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_getbufvar()
|
func Test_getbufvar()
|
||||||
let bnr = bufnr('%')
|
let bnr = bufnr('%')
|
||||||
let b:var_num = '1234'
|
let b:var_num = '1234'
|
||||||
@@ -913,6 +936,7 @@ func Test_match_func()
|
|||||||
call assert_equal(-1, match(['a', 'b', 'c', 'a'], 'a', 5))
|
call assert_equal(-1, match(['a', 'b', 'c', 'a'], 'a', 5))
|
||||||
call assert_equal(4, match('testing', 'ing', -1))
|
call assert_equal(4, match('testing', 'ing', -1))
|
||||||
call assert_fails("let x=match('testing', 'ing', 0, [])", 'E745:')
|
call assert_fails("let x=match('testing', 'ing', 0, [])", 'E745:')
|
||||||
|
call assert_equal(-1, match(test_null_list(), 2))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_matchend()
|
func Test_matchend()
|
||||||
@@ -1796,6 +1820,7 @@ func Test_call()
|
|||||||
call assert_equal(3, 'len'->call([123]))
|
call assert_equal(3, 'len'->call([123]))
|
||||||
call assert_fails("call call('len', 123)", 'E714:')
|
call assert_fails("call call('len', 123)", 'E714:')
|
||||||
call assert_equal(0, call('', []))
|
call assert_equal(0, call('', []))
|
||||||
|
call assert_equal(0, call('len', test_null_list()))
|
||||||
|
|
||||||
function Mylen() dict
|
function Mylen() dict
|
||||||
return len(self.data)
|
return len(self.data)
|
||||||
@@ -1962,7 +1987,6 @@ func Test_range()
|
|||||||
execute "normal! a\<C-r>=[complete(col('.'), range(10)), ''][1]\<CR>"
|
execute "normal! a\<C-r>=[complete(col('.'), range(10)), ''][1]\<CR>"
|
||||||
" complete_info()
|
" complete_info()
|
||||||
execute "normal! a\<C-r>=[complete(col('.'), range(10)), ''][1]\<CR>\<C-r>=[complete_info(range(5)), ''][1]\<CR>"
|
execute "normal! a\<C-r>=[complete(col('.'), range(10)), ''][1]\<CR>\<C-r>=[complete_info(range(5)), ''][1]\<CR>"
|
||||||
call assert_fails('call complete(1, ["a"])', 'E785:')
|
|
||||||
|
|
||||||
" copy()
|
" copy()
|
||||||
call assert_equal([1, 2, 3], copy(range(1, 3)))
|
call assert_equal([1, 2, 3], copy(range(1, 3)))
|
||||||
|
@@ -469,6 +469,7 @@ endfunc
|
|||||||
" Test for 'completefunc' deleting text
|
" Test for 'completefunc' deleting text
|
||||||
func Test_completefunc_error()
|
func Test_completefunc_error()
|
||||||
new
|
new
|
||||||
|
" delete text when called for the first time
|
||||||
func CompleteFunc(findstart, base)
|
func CompleteFunc(findstart, base)
|
||||||
if a:findstart == 1
|
if a:findstart == 1
|
||||||
normal dd
|
normal dd
|
||||||
@@ -479,9 +480,39 @@ func Test_completefunc_error()
|
|||||||
set completefunc=CompleteFunc
|
set completefunc=CompleteFunc
|
||||||
call setline(1, ['', 'abcd', ''])
|
call setline(1, ['', 'abcd', ''])
|
||||||
call assert_fails('exe "normal 2G$a\<C-X>\<C-U>"', 'E840:')
|
call assert_fails('exe "normal 2G$a\<C-X>\<C-U>"', 'E840:')
|
||||||
|
|
||||||
|
" delete text when called for the second time
|
||||||
|
func CompleteFunc2(findstart, base)
|
||||||
|
if a:findstart == 1
|
||||||
|
return col('.') - 1
|
||||||
|
endif
|
||||||
|
normal dd
|
||||||
|
return ['a', 'b']
|
||||||
|
endfunc
|
||||||
|
set completefunc=CompleteFunc2
|
||||||
|
call setline(1, ['', 'abcd', ''])
|
||||||
|
call assert_fails('exe "normal 2G$a\<C-X>\<C-U>"', 'E565:')
|
||||||
|
|
||||||
set completefunc&
|
set completefunc&
|
||||||
delfunc CompleteFunc
|
delfunc CompleteFunc
|
||||||
|
delfunc CompleteFunc2
|
||||||
close!
|
close!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Test for errors in using complete() function
|
||||||
|
func Test_complete_func_error()
|
||||||
|
call assert_fails('call complete(1, ["a"])', 'E785:')
|
||||||
|
func ListColors()
|
||||||
|
call complete(col('.'), "blue")
|
||||||
|
endfunc
|
||||||
|
call assert_fails('exe "normal i\<C-R>=ListColors()\<CR>"', 'E474:')
|
||||||
|
func ListMonths()
|
||||||
|
call complete(col('.'), test_null_list())
|
||||||
|
endfunc
|
||||||
|
call assert_fails('exe "normal i\<C-R>=ListMonths()\<CR>"', 'E474:')
|
||||||
|
delfunc ListColors
|
||||||
|
delfunc ListMonths
|
||||||
|
call assert_fails('call complete_info({})', 'E714:')
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -853,6 +853,9 @@ func Test_popup_invalid_arguments()
|
|||||||
call popup_clear()
|
call popup_clear()
|
||||||
call assert_fails('call popup_create("text", "none")', 'E715:')
|
call assert_fails('call popup_create("text", "none")', 'E715:')
|
||||||
call popup_clear()
|
call popup_clear()
|
||||||
|
call assert_fails('call popup_create(test_null_string(), {})', 'E450:')
|
||||||
|
call assert_fails('call popup_create(test_null_list(), {})', 'E450:')
|
||||||
|
call popup_clear()
|
||||||
|
|
||||||
call assert_fails('call popup_create("text", #{col: "xxx"})', 'E475:')
|
call assert_fails('call popup_create("text", #{col: "xxx"})', 'E475:')
|
||||||
call popup_clear()
|
call popup_clear()
|
||||||
@@ -902,6 +905,8 @@ func Test_popup_invalid_arguments()
|
|||||||
call assert_fails('call popup_create("text", #{mask: test_null_list()})', 'E475:')
|
call assert_fails('call popup_create("text", #{mask: test_null_list()})', 'E475:')
|
||||||
call assert_fails('call popup_create("text", #{mapping: []})', 'E745:')
|
call assert_fails('call popup_create("text", #{mapping: []})', 'E745:')
|
||||||
call popup_clear()
|
call popup_clear()
|
||||||
|
call assert_fails('call popup_create("text", #{tabpage : 4})', 'E997:')
|
||||||
|
call popup_clear()
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_win_execute_closing_curwin()
|
func Test_win_execute_closing_curwin()
|
||||||
@@ -1113,8 +1118,13 @@ func Test_popup_move()
|
|||||||
let line = join(map(range(1, 6), 'screenstring(1, v:val)'), '')
|
let line = join(map(range(1, 6), 'screenstring(1, v:val)'), '')
|
||||||
call assert_equal('hworld', line)
|
call assert_equal('hworld', line)
|
||||||
|
|
||||||
|
call assert_fails('call popup_move(winid, [])', 'E715:')
|
||||||
|
call assert_fails('call popup_move(winid, test_null_dict())', 'E715:')
|
||||||
|
|
||||||
call popup_close(winid)
|
call popup_close(winid)
|
||||||
|
|
||||||
|
call assert_equal(0, popup_move(-1, {}))
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -2176,7 +2186,11 @@ func Test_set_get_options()
|
|||||||
call assert_equal(1, options.drag)
|
call assert_equal(1, options.drag)
|
||||||
call assert_equal('Another', options.highlight)
|
call assert_equal('Another', options.highlight)
|
||||||
|
|
||||||
|
call assert_fails('call popup_setoptions(winid, [])', 'E715:')
|
||||||
|
call assert_fails('call popup_setoptions(winid, test_null_dict())', 'E715:')
|
||||||
|
|
||||||
call popup_close(winid)
|
call popup_close(winid)
|
||||||
|
call assert_equal(0, popup_setoptions(winid, options.wrap))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_popupwin_garbage_collect()
|
func Test_popupwin_garbage_collect()
|
||||||
|
@@ -148,6 +148,7 @@ func Test_prompt_buffer_edit()
|
|||||||
call assert_beeps("normal! \<C-A>")
|
call assert_beeps("normal! \<C-A>")
|
||||||
call assert_beeps("normal! \<C-X>")
|
call assert_beeps("normal! \<C-X>")
|
||||||
close!
|
close!
|
||||||
|
call assert_equal(0, prompt_setprompt([], ''))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -285,6 +285,7 @@ func Test_getsettagstack()
|
|||||||
call assert_fails("call settagstack(1, {'items' : 10})", 'E714')
|
call assert_fails("call settagstack(1, {'items' : 10})", 'E714')
|
||||||
call assert_fails("call settagstack(1, {'items' : []}, 10)", 'E928')
|
call assert_fails("call settagstack(1, {'items' : []}, 10)", 'E928')
|
||||||
call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962')
|
call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962')
|
||||||
|
call assert_equal(-1, settagstack(0, test_null_dict()))
|
||||||
|
|
||||||
set tags=Xtags
|
set tags=Xtags
|
||||||
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
|
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
|
||||||
|
@@ -1079,4 +1079,16 @@ func Test_split_cmds_with_no_room()
|
|||||||
call Run_noroom_for_newwindow_test('v')
|
call Run_noroom_for_newwindow_test('v')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Test for various wincmd failures
|
||||||
|
func Test_wincmd_fails()
|
||||||
|
only!
|
||||||
|
call assert_beeps("normal \<C-W>w")
|
||||||
|
call assert_beeps("normal \<C-W>p")
|
||||||
|
call assert_beeps("normal \<C-W>gk")
|
||||||
|
call assert_beeps("normal \<C-W>r")
|
||||||
|
call assert_beeps("normal \<C-W>K")
|
||||||
|
call assert_beeps("normal \<C-W>H")
|
||||||
|
call assert_beeps("normal \<C-W>2gt")
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
615,
|
||||||
/**/
|
/**/
|
||||||
614,
|
614,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user