mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #17299 from zeertzjq/vim-8.1.0711
vim-patch:7.4.{1163,1164,1167,1173,1178,1181,1228},8.1.0711
This commit is contained in:
commit
380bc4fe22
@ -4,7 +4,7 @@ source shared.vim
|
|||||||
source check.vim
|
source check.vim
|
||||||
source term_util.vim
|
source term_util.vim
|
||||||
|
|
||||||
func! s:cleanup_buffers() abort
|
func s:cleanup_buffers() abort
|
||||||
for bnr in range(1, bufnr('$'))
|
for bnr in range(1, bufnr('$'))
|
||||||
if bufloaded(bnr) && bufnr('%') != bnr
|
if bufloaded(bnr) && bufnr('%') != bnr
|
||||||
execute 'bd! ' . bnr
|
execute 'bd! ' . bnr
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Tests for related f{char} and t{char} using utf-8.
|
" Tests for related f{char} and t{char} using utf-8.
|
||||||
|
|
||||||
" Test for t,f,F,T movement commands
|
" Test for t,f,F,T movement commands
|
||||||
function! Test_search_cmds()
|
func Test_search_cmds()
|
||||||
new!
|
new!
|
||||||
call setline(1, "・最初から最後まで最強のVimは最高")
|
call setline(1, "・最初から最後まで最強のVimは最高")
|
||||||
1
|
1
|
||||||
|
@ -41,7 +41,7 @@ func Test_display_foldcolumn()
|
|||||||
quit!
|
quit!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_display_foldtext_mbyte()
|
func Test_display_foldtext_mbyte()
|
||||||
CheckFeature folding
|
CheckFeature folding
|
||||||
|
|
||||||
call NewWindow(10, 40)
|
call NewWindow(10, 40)
|
||||||
|
@ -213,7 +213,7 @@ func Test_edit_07()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_08()
|
func Test_edit_08()
|
||||||
throw 'skipped: moved to test/functional/legacy/edit_spec.lua'
|
throw 'skipped: moved to test/functional/legacy/edit_spec.lua'
|
||||||
" reset insertmode from i_ctrl-r_=
|
" reset insertmode from i_ctrl-r_=
|
||||||
let g:bufnr = bufnr('%')
|
let g:bufnr = bufnr('%')
|
||||||
@ -417,7 +417,7 @@ func Test_edit_13()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CR()
|
func Test_edit_CR()
|
||||||
" Test for <CR> in insert mode
|
" Test for <CR> in insert mode
|
||||||
" basically only in quickfix mode ist tested, the rest
|
" basically only in quickfix mode ist tested, the rest
|
||||||
" has been taken care of by other tests
|
" has been taken care of by other tests
|
||||||
@ -450,7 +450,7 @@ func! Test_edit_CR()
|
|||||||
call delete('Xqflist.txt')
|
call delete('Xqflist.txt')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_()
|
func Test_edit_CTRL_()
|
||||||
" disabled for Windows builds, why?
|
" disabled for Windows builds, why?
|
||||||
if !has("rightleft") || has("win32")
|
if !has("rightleft") || has("win32")
|
||||||
return
|
return
|
||||||
@ -734,7 +734,7 @@ func Test_edit_CTRL_O()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_R()
|
func Test_edit_CTRL_R()
|
||||||
" Insert Register
|
" Insert Register
|
||||||
new
|
new
|
||||||
" call test_override("ALL", 1)
|
" call test_override("ALL", 1)
|
||||||
|
@ -109,7 +109,7 @@ func s:CompleteDone_CompleteFuncNone( findstart, base )
|
|||||||
return v:none
|
return v:none
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! s:CompleteDone_CompleteFuncDict( findstart, base )
|
func s:CompleteDone_CompleteFuncDict( findstart, base )
|
||||||
if a:findstart
|
if a:findstart
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
@ -126,7 +126,7 @@ function! s:CompleteDone_CompleteFuncDict( findstart, base )
|
|||||||
\ }
|
\ }
|
||||||
\ ]
|
\ ]
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func s:CompleteDone_CheckCompletedItemNone()
|
func s:CompleteDone_CheckCompletedItemNone()
|
||||||
let s:called_completedone = 1
|
let s:called_completedone = 1
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
" Test for lambda and closure
|
" Test for lambda and closure
|
||||||
|
|
||||||
function! Test_lambda_feature()
|
func Test_lambda_feature()
|
||||||
call assert_equal(1, has('lambda'))
|
call assert_equal(1, has('lambda'))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_with_filter()
|
func Test_lambda_with_filter()
|
||||||
let s:x = 2
|
let s:x = 2
|
||||||
call assert_equal([2, 3], filter([1, 2, 3], {i, v -> v >= s:x}))
|
call assert_equal([2, 3], filter([1, 2, 3], {i, v -> v >= s:x}))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_with_map()
|
func Test_lambda_with_map()
|
||||||
let s:x = 1
|
let s:x = 1
|
||||||
call assert_equal([2, 3, 4], map([1, 2, 3], {i, v -> v + s:x}))
|
call assert_equal([2, 3, 4], map([1, 2, 3], {i, v -> v + s:x}))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_with_sort()
|
func Test_lambda_with_sort()
|
||||||
call assert_equal([1, 2, 3, 4, 7], sort([3,7,2,1,4], {a, b -> a - b}))
|
call assert_equal([1, 2, 3, 4, 7], sort([3,7,2,1,4], {a, b -> a - b}))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_with_timer()
|
func Test_lambda_with_timer()
|
||||||
if !has('timers')
|
if !has('timers')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@ -54,10 +54,10 @@ function! Test_lambda_with_timer()
|
|||||||
call assert_true(s:n > m)
|
call assert_true(s:n > m)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_with_partial()
|
func Test_lambda_with_partial()
|
||||||
let l:Cb = function({... -> ['zero', a:1, a:2, a:3]}, ['one', 'two'])
|
let l:Cb = function({... -> ['zero', a:1, a:2, a:3]}, ['one', 'two'])
|
||||||
call assert_equal(['zero', 'one', 'two', 'three'], l:Cb('three'))
|
call assert_equal(['zero', 'one', 'two', 'three'], l:Cb('three'))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function Test_lambda_fails()
|
function Test_lambda_fails()
|
||||||
call assert_equal(3, {a, b -> a + b}(1, 2))
|
call assert_equal(3, {a, b -> a + b}(1, 2))
|
||||||
@ -70,59 +70,59 @@ func Test_not_lambda()
|
|||||||
call assert_equal('foo', x['>'])
|
call assert_equal('foo', x['>'])
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_capture_by_reference()
|
func Test_lambda_capture_by_reference()
|
||||||
let v = 1
|
let v = 1
|
||||||
let l:F = {x -> x + v}
|
let l:F = {x -> x + v}
|
||||||
let v = 2
|
let v = 2
|
||||||
call assert_equal(12, l:F(10))
|
call assert_equal(12, l:F(10))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_side_effect()
|
func Test_lambda_side_effect()
|
||||||
function! s:update_and_return(arr)
|
func! s:update_and_return(arr)
|
||||||
let a:arr[1] = 5
|
let a:arr[1] = 5
|
||||||
return a:arr
|
return a:arr
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! s:foo(arr)
|
func! s:foo(arr)
|
||||||
return {-> s:update_and_return(a:arr)}
|
return {-> s:update_and_return(a:arr)}
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let arr = [3,2,1]
|
let arr = [3,2,1]
|
||||||
call assert_equal([3, 5, 1], s:foo(arr)())
|
call assert_equal([3, 5, 1], s:foo(arr)())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_refer_local_variable_from_other_scope()
|
func Test_lambda_refer_local_variable_from_other_scope()
|
||||||
function! s:foo(X)
|
func! s:foo(X)
|
||||||
return a:X() " refer l:x in s:bar()
|
return a:X() " refer l:x in s:bar()
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! s:bar()
|
func! s:bar()
|
||||||
let x = 123
|
let x = 123
|
||||||
return s:foo({-> x})
|
return s:foo({-> x})
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
call assert_equal(123, s:bar())
|
call assert_equal(123, s:bar())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_do_not_share_local_variable()
|
func Test_lambda_do_not_share_local_variable()
|
||||||
function! s:define_funcs()
|
func! s:define_funcs()
|
||||||
let l:One = {-> split(execute("let a = 'abc' | echo a"))[0]}
|
let l:One = {-> split(execute("let a = 'abc' | echo a"))[0]}
|
||||||
let l:Two = {-> exists("a") ? a : "no"}
|
let l:Two = {-> exists("a") ? a : "no"}
|
||||||
return [l:One, l:Two]
|
return [l:One, l:Two]
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let l:F = s:define_funcs()
|
let l:F = s:define_funcs()
|
||||||
|
|
||||||
call assert_equal('no', l:F[1]())
|
call assert_equal('no', l:F[1]())
|
||||||
call assert_equal('abc', l:F[0]())
|
call assert_equal('abc', l:F[0]())
|
||||||
call assert_equal('no', l:F[1]())
|
call assert_equal('no', l:F[1]())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_closure_counter()
|
func Test_lambda_closure_counter()
|
||||||
function! s:foo()
|
func! s:foo()
|
||||||
let x = 0
|
let x = 0
|
||||||
return {-> [execute("let x += 1"), x][-1]}
|
return {-> [execute("let x += 1"), x][-1]}
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let l:F = s:foo()
|
let l:F = s:foo()
|
||||||
call garbagecollect()
|
call garbagecollect()
|
||||||
@ -130,52 +130,52 @@ function! Test_lambda_closure_counter()
|
|||||||
call assert_equal(2, l:F())
|
call assert_equal(2, l:F())
|
||||||
call assert_equal(3, l:F())
|
call assert_equal(3, l:F())
|
||||||
call assert_equal(4, l:F())
|
call assert_equal(4, l:F())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_with_a_var()
|
func Test_lambda_with_a_var()
|
||||||
function! s:foo()
|
func! s:foo()
|
||||||
let x = 2
|
let x = 2
|
||||||
return {... -> a:000 + [x]}
|
return {... -> a:000 + [x]}
|
||||||
endfunction
|
endfunc
|
||||||
function! s:bar()
|
func! s:bar()
|
||||||
return s:foo()(1)
|
return s:foo()(1)
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
call assert_equal([1, 2], s:bar())
|
call assert_equal([1, 2], s:bar())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_call_lambda_from_lambda()
|
func Test_lambda_call_lambda_from_lambda()
|
||||||
function! s:foo(x)
|
func! s:foo(x)
|
||||||
let l:F1 = {-> {-> a:x}}
|
let l:F1 = {-> {-> a:x}}
|
||||||
return {-> l:F1()}
|
return {-> l:F1()}
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let l:F = s:foo(1)
|
let l:F = s:foo(1)
|
||||||
call assert_equal(1, l:F()())
|
call assert_equal(1, l:F()())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_delfunc()
|
func Test_lambda_delfunc()
|
||||||
function! s:gen()
|
func! s:gen()
|
||||||
let pl = l:
|
let pl = l:
|
||||||
let l:Foo = {-> get(pl, "Foo", get(pl, "Bar", {-> 0}))}
|
let l:Foo = {-> get(pl, "Foo", get(pl, "Bar", {-> 0}))}
|
||||||
let l:Bar = l:Foo
|
let l:Bar = l:Foo
|
||||||
delfunction l:Foo
|
delfunction l:Foo
|
||||||
return l:Bar
|
return l:Bar
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let l:F = s:gen()
|
let l:F = s:gen()
|
||||||
call assert_fails(':call l:F()', 'E933:')
|
call assert_fails(':call l:F()', 'E933:')
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_scope()
|
func Test_lambda_scope()
|
||||||
function! s:NewCounter()
|
func! s:NewCounter()
|
||||||
let c = 0
|
let c = 0
|
||||||
return {-> [execute('let c += 1'), c][-1]}
|
return {-> [execute('let c += 1'), c][-1]}
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! s:NewCounter2()
|
func! s:NewCounter2()
|
||||||
return {-> [execute('let c += 100'), c][-1]}
|
return {-> [execute('let c += 100'), c][-1]}
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let l:C = s:NewCounter()
|
let l:C = s:NewCounter()
|
||||||
let l:D = s:NewCounter2()
|
let l:D = s:NewCounter2()
|
||||||
@ -183,37 +183,37 @@ function! Test_lambda_scope()
|
|||||||
call assert_equal(1, l:C())
|
call assert_equal(1, l:C())
|
||||||
call assert_fails(':call l:D()', 'E121:')
|
call assert_fails(':call l:D()', 'E121:')
|
||||||
call assert_equal(2, l:C())
|
call assert_equal(2, l:C())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_share_scope()
|
func Test_lambda_share_scope()
|
||||||
function! s:New()
|
func! s:New()
|
||||||
let c = 0
|
let c = 0
|
||||||
let l:Inc0 = {-> [execute('let c += 1'), c][-1]}
|
let l:Inc0 = {-> [execute('let c += 1'), c][-1]}
|
||||||
let l:Dec0 = {-> [execute('let c -= 1'), c][-1]}
|
let l:Dec0 = {-> [execute('let c -= 1'), c][-1]}
|
||||||
return [l:Inc0, l:Dec0]
|
return [l:Inc0, l:Dec0]
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let [l:Inc, l:Dec] = s:New()
|
let [l:Inc, l:Dec] = s:New()
|
||||||
|
|
||||||
call assert_equal(1, l:Inc())
|
call assert_equal(1, l:Inc())
|
||||||
call assert_equal(2, l:Inc())
|
call assert_equal(2, l:Inc())
|
||||||
call assert_equal(1, l:Dec())
|
call assert_equal(1, l:Dec())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_circular_reference()
|
func Test_lambda_circular_reference()
|
||||||
function! s:Foo()
|
func! s:Foo()
|
||||||
let d = {}
|
let d = {}
|
||||||
let d.f = {-> d}
|
let d.f = {-> d}
|
||||||
return d.f
|
return d.f
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
call s:Foo()
|
call s:Foo()
|
||||||
call garbagecollect()
|
call garbagecollect()
|
||||||
let i = 0 | while i < 10000 | call s:Foo() | let i+= 1 | endwhile
|
let i = 0 | while i < 10000 | call s:Foo() | let i+= 1 | endwhile
|
||||||
call garbagecollect()
|
call garbagecollect()
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_combination()
|
func Test_lambda_combination()
|
||||||
call assert_equal(2, {x -> {x -> x}}(1)(2))
|
call assert_equal(2, {x -> {x -> x}}(1)(2))
|
||||||
call assert_equal(10, {y -> {x -> x(y)(10)}({y -> y})}({z -> z}))
|
call assert_equal(10, {y -> {x -> x(y)(10)}({y -> y})}({z -> z}))
|
||||||
call assert_equal(5.0, {x -> {y -> x / y}}(10)(2.0))
|
call assert_equal(5.0, {x -> {y -> x / y}}(10)(2.0))
|
||||||
@ -226,17 +226,17 @@ function! Test_lambda_combination()
|
|||||||
let Z = {f -> {x -> f({y -> x(x)(y)})}({x -> f({y -> x(x)(y)})})}
|
let Z = {f -> {x -> f({y -> x(x)(y)})}({x -> f({y -> x(x)(y)})})}
|
||||||
let Fact = {f -> {x -> x == 0 ? 1 : x * f(x - 1)}}
|
let Fact = {f -> {x -> x == 0 ? 1 : x * f(x - 1)}}
|
||||||
call assert_equal(120, Z(Fact)(5))
|
call assert_equal(120, Z(Fact)(5))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_closure_counter()
|
func Test_closure_counter()
|
||||||
function! s:foo()
|
func! s:foo()
|
||||||
let x = 0
|
let x = 0
|
||||||
function! s:bar() closure
|
func! s:bar() closure
|
||||||
let x += 1
|
let x += 1
|
||||||
return x
|
return x
|
||||||
endfunction
|
endfunc
|
||||||
return function('s:bar')
|
return function('s:bar')
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let l:F = s:foo()
|
let l:F = s:foo()
|
||||||
call garbagecollect()
|
call garbagecollect()
|
||||||
@ -244,30 +244,30 @@ function! Test_closure_counter()
|
|||||||
call assert_equal(2, l:F())
|
call assert_equal(2, l:F())
|
||||||
call assert_equal(3, l:F())
|
call assert_equal(3, l:F())
|
||||||
call assert_equal(4, l:F())
|
call assert_equal(4, l:F())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_closure_unlet()
|
func Test_closure_unlet()
|
||||||
function! s:foo()
|
func! s:foo()
|
||||||
let x = 1
|
let x = 1
|
||||||
function! s:bar() closure
|
func! s:bar() closure
|
||||||
unlet x
|
unlet x
|
||||||
endfunction
|
endfunc
|
||||||
call s:bar()
|
call s:bar()
|
||||||
return l:
|
return l:
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
call assert_false(has_key(s:foo(), 'x'))
|
call assert_false(has_key(s:foo(), 'x'))
|
||||||
call garbagecollect()
|
call garbagecollect()
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! LambdaFoo()
|
func LambdaFoo()
|
||||||
let x = 0
|
let x = 0
|
||||||
function! LambdaBar() closure
|
func! LambdaBar() closure
|
||||||
let x += 1
|
let x += 1
|
||||||
return x
|
return x
|
||||||
endfunction
|
endfunc
|
||||||
return function('LambdaBar')
|
return function('LambdaBar')
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_closure_refcount()
|
func Test_closure_refcount()
|
||||||
let g:Count = LambdaFoo()
|
let g:Count = LambdaFoo()
|
||||||
|
@ -516,22 +516,22 @@ func Test_dict_lock_operator()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" No remove() of write-protected scope-level variable
|
" No remove() of write-protected scope-level variable
|
||||||
func! Tfunc(this_is_a_long_parameter_name)
|
func Tfunc1(this_is_a_long_parameter_name)
|
||||||
call assert_fails("call remove(a:, 'this_is_a_long_parameter_name')", 'E742')
|
call assert_fails("call remove(a:, 'this_is_a_long_parameter_name')", 'E742')
|
||||||
endfun
|
endfunc
|
||||||
func Test_dict_scope_var_remove()
|
func Test_dict_scope_var_remove()
|
||||||
call Tfunc('testval')
|
call Tfunc1('testval')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" No extend() of write-protected scope-level variable
|
" No extend() of write-protected scope-level variable
|
||||||
func Test_dict_scope_var_extend()
|
func Test_dict_scope_var_extend()
|
||||||
call assert_fails("call extend(a:, {'this_is_a_long_parameter_name': 1234})", 'E742')
|
call assert_fails("call extend(a:, {'this_is_a_long_parameter_name': 1234})", 'E742')
|
||||||
endfunc
|
endfunc
|
||||||
func! Tfunc(this_is_a_long_parameter_name)
|
func Tfunc2(this_is_a_long_parameter_name)
|
||||||
call assert_fails("call extend(a:, {'this_is_a_long_parameter_name': 1234})", 'E742')
|
call assert_fails("call extend(a:, {'this_is_a_long_parameter_name': 1234})", 'E742')
|
||||||
endfunc
|
endfunc
|
||||||
func Test_dict_scope_var_extend_overwrite()
|
func Test_dict_scope_var_extend_overwrite()
|
||||||
call Tfunc('testval')
|
call Tfunc2('testval')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" No :unlet of variable in locked scope
|
" No :unlet of variable in locked scope
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
" Test that a deleted mark is restored after delete-undo-redo-undo.
|
" Test that a deleted mark is restored after delete-undo-redo-undo.
|
||||||
function! Test_Restore_DelMark()
|
func Test_Restore_DelMark()
|
||||||
enew!
|
enew!
|
||||||
call append(0, [" textline A", " textline B", " textline C"])
|
call append(0, [" textline A", " textline B", " textline C"])
|
||||||
normal! 2gg
|
normal! 2gg
|
||||||
@ -11,10 +11,10 @@ function! Test_Restore_DelMark()
|
|||||||
call assert_equal(2, pos[1])
|
call assert_equal(2, pos[1])
|
||||||
call assert_equal(1, pos[2])
|
call assert_equal(1, pos[2])
|
||||||
enew!
|
enew!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
" Test that CTRL-A and CTRL-X updates last changed mark '[, '].
|
" Test that CTRL-A and CTRL-X updates last changed mark '[, '].
|
||||||
function! Test_Incr_Marks()
|
func Test_Incr_Marks()
|
||||||
enew!
|
enew!
|
||||||
call append(0, ["123 123 123", "123 123 123", "123 123 123"])
|
call append(0, ["123 123 123", "123 123 123", "123 123 123"])
|
||||||
normal! gg
|
normal! gg
|
||||||
@ -23,7 +23,7 @@ function! Test_Incr_Marks()
|
|||||||
call assert_equal("123 XXXXXXX", getline(2))
|
call assert_equal("123 XXXXXXX", getline(2))
|
||||||
call assert_equal("XXX 123 123", getline(3))
|
call assert_equal("XXX 123 123", getline(3))
|
||||||
enew!
|
enew!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_previous_jump_mark()
|
func Test_previous_jump_mark()
|
||||||
new
|
new
|
||||||
|
@ -7,7 +7,7 @@ source shared.vim
|
|||||||
source term_util.vim
|
source term_util.vim
|
||||||
source view_util.vim
|
source view_util.vim
|
||||||
|
|
||||||
function! Test_simple_matchadd()
|
func Test_simple_matchadd()
|
||||||
new
|
new
|
||||||
|
|
||||||
1put='# This is a Test'
|
1put='# This is a Test'
|
||||||
@ -333,7 +333,7 @@ func Test_matchadd_and_syn_conceal()
|
|||||||
call assert_notequal(screenattr(1, 10) , screenattr(1, 11))
|
call assert_notequal(screenattr(1, 10) , screenattr(1, 11))
|
||||||
call assert_notequal(screenattr(1, 11) , screenattr(1, 12))
|
call assert_notequal(screenattr(1, 11) , screenattr(1, 12))
|
||||||
call assert_equal(screenattr(1, 11) , screenattr(1, 32))
|
call assert_equal(screenattr(1, 11) , screenattr(1, 32))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_cursor_column_in_concealed_line_after_window_scroll()
|
func Test_cursor_column_in_concealed_line_after_window_scroll()
|
||||||
CheckRunVimInTerminal
|
CheckRunVimInTerminal
|
||||||
|
@ -3,19 +3,19 @@ if !has('conceal')
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! s:screenline(lnum) abort
|
func s:screenline(lnum) abort
|
||||||
let line = []
|
let line = []
|
||||||
for c in range(1, winwidth(0))
|
for c in range(1, winwidth(0))
|
||||||
call add(line, nr2char(a:lnum->screenchar(c)))
|
call add(line, nr2char(a:lnum->screenchar(c)))
|
||||||
endfor
|
endfor
|
||||||
return s:trim(join(line, ''))
|
return s:trim(join(line, ''))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! s:trim(str) abort
|
func s:trim(str) abort
|
||||||
return matchstr(a:str,'^\s*\zs.\{-}\ze\s*$')
|
return matchstr(a:str,'^\s*\zs.\{-}\ze\s*$')
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_match_using_multibyte_conceal_char()
|
func Test_match_using_multibyte_conceal_char()
|
||||||
new
|
new
|
||||||
setlocal concealcursor=n conceallevel=1
|
setlocal concealcursor=n conceallevel=1
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ endfunc
|
|||||||
" indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked. Message
|
" indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked. Message
|
||||||
" output could then be disturbed when 'cmdheight' was greater than one.
|
" output could then be disturbed when 'cmdheight' was greater than one.
|
||||||
" This test ensures that the bugfix for this issue remains in place.
|
" This test ensures that the bugfix for this issue remains in place.
|
||||||
function! Test_stopinsert_does_not_break_message_output()
|
func Test_stopinsert_does_not_break_message_output()
|
||||||
set cmdheight=2
|
set cmdheight=2
|
||||||
redraw!
|
redraw!
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ function! Test_stopinsert_does_not_break_message_output()
|
|||||||
redraw!
|
redraw!
|
||||||
|
|
||||||
set cmdheight&
|
set cmdheight&
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_message_completion()
|
func Test_message_completion()
|
||||||
call feedkeys(":message \<C-A>\<C-B>\"\<CR>", 'tx')
|
call feedkeys(":message \<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
@ -22,16 +22,16 @@ func Test_whichwrap()
|
|||||||
call assert_equal('h', &whichwrap)
|
call assert_equal('h', &whichwrap)
|
||||||
|
|
||||||
set whichwrap&
|
set whichwrap&
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_isfname()
|
func Test_isfname()
|
||||||
" This used to cause Vim to access uninitialized memory.
|
" This used to cause Vim to access uninitialized memory.
|
||||||
set isfname=
|
set isfname=
|
||||||
call assert_equal("~X", expand("~X"))
|
call assert_equal("~X", expand("~X"))
|
||||||
set isfname&
|
set isfname&
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function Test_wildchar()
|
func Test_wildchar()
|
||||||
" Empty 'wildchar' used to access invalid memory.
|
" Empty 'wildchar' used to access invalid memory.
|
||||||
call assert_fails('set wildchar=', 'E521:')
|
call assert_fails('set wildchar=', 'E521:')
|
||||||
call assert_fails('set wildchar=abc', 'E521:')
|
call assert_fails('set wildchar=abc', 'E521:')
|
||||||
@ -42,7 +42,7 @@ function Test_wildchar()
|
|||||||
let a=execute('set wildchar?')
|
let a=execute('set wildchar?')
|
||||||
call assert_equal("\n wildchar=<Esc>", a)
|
call assert_equal("\n wildchar=<Esc>", a)
|
||||||
set wildchar&
|
set wildchar&
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_wildoptions()
|
func Test_wildoptions()
|
||||||
set wildoptions=
|
set wildoptions=
|
||||||
@ -90,7 +90,7 @@ func Test_options_command()
|
|||||||
close
|
close
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! Test_path_keep_commas()
|
func Test_path_keep_commas()
|
||||||
" Test that changing 'path' keeps two commas.
|
" Test that changing 'path' keeps two commas.
|
||||||
set path=foo,,bar
|
set path=foo,,bar
|
||||||
set path-=bar
|
set path-=bar
|
||||||
@ -98,7 +98,7 @@ function! Test_path_keep_commas()
|
|||||||
call assert_equal('foo,,bar', &path)
|
call assert_equal('foo,,bar', &path)
|
||||||
|
|
||||||
set path&
|
set path&
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_filetype_valid()
|
func Test_filetype_valid()
|
||||||
set ft=valid_name
|
set ft=valid_name
|
||||||
|
@ -105,7 +105,7 @@ func Test_substitute_variants()
|
|||||||
call assert_equal(var.exp, getline('.'), msg)
|
call assert_equal(var.exp, getline('.'), msg)
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
" Test the l, p, # flags.
|
" Test the l, p, # flags.
|
||||||
func Test_substitute_flags_lp()
|
func Test_substitute_flags_lp()
|
||||||
|
@ -46,9 +46,9 @@ func Test_System()
|
|||||||
bwipe!
|
bwipe!
|
||||||
|
|
||||||
call assert_fails('call system("wc -l", 99999)', 'E86:')
|
call assert_fails('call system("wc -l", 99999)', 'E86:')
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_system_exmode()
|
func Test_system_exmode()
|
||||||
if has('unix') " echo $? only works on Unix
|
if has('unix') " echo $? only works on Unix
|
||||||
let cmd = ' -es --headless -u NONE -c "source Xscript" +q; echo "result=$?"'
|
let cmd = ' -es --headless -u NONE -c "source Xscript" +q; echo "result=$?"'
|
||||||
" Need to put this in a script, "catch" isn't found after an unknown
|
" Need to put this in a script, "catch" isn't found after an unknown
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
" Tests for case-insensitive UTF-8 comparisons (utf_strnicmp() in mbyte.c)
|
" Tests for case-insensitive UTF-8 comparisons (utf_strnicmp() in mbyte.c)
|
||||||
" Also test "g~ap".
|
" Also test "g~ap".
|
||||||
|
|
||||||
function! Ch(a, op, b, expected)
|
func Ch(a, op, b, expected)
|
||||||
call assert_equal(eval(printf('"%s" %s "%s"', a:a, a:op, a:b)), a:expected,
|
call assert_equal(eval(printf('"%s" %s "%s"', a:a, a:op, a:b)), a:expected,
|
||||||
\ printf('"%s" %s "%s" should return %d', a:a, a:op, a:b, a:expected))
|
\ printf('"%s" %s "%s" should return %d', a:a, a:op, a:b, a:expected))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Chk(a, b, result)
|
func Chk(a, b, result)
|
||||||
if a:result == 0
|
if a:result == 0
|
||||||
call Ch(a:a, '==?', a:b, 1)
|
call Ch(a:a, '==?', a:b, 1)
|
||||||
call Ch(a:a, '!=?', a:b, 0)
|
call Ch(a:a, '!=?', a:b, 0)
|
||||||
|
@ -145,7 +145,7 @@ func Test_retab_invalid_arg()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_vartabs_breakindent()
|
func Test_vartabs_breakindent()
|
||||||
if !exists("+breakindent")
|
if !exists("+breakindent")
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
@ -25,7 +25,7 @@ com! -nargs=1 Xout call Xout(<args>)
|
|||||||
" in the variable argument list. This function is useful if similar tests are
|
" in the variable argument list. This function is useful if similar tests are
|
||||||
" to be made for a ":return" from a function call or a ":finish" in a script
|
" to be made for a ":return" from a function call or a ":finish" in a script
|
||||||
" file.
|
" file.
|
||||||
function! MakeScript(funcname, ...)
|
func MakeScript(funcname, ...)
|
||||||
let script = tempname()
|
let script = tempname()
|
||||||
execute "redir! >" . script
|
execute "redir! >" . script
|
||||||
execute "function" a:funcname
|
execute "function" a:funcname
|
||||||
@ -1156,6 +1156,82 @@ func Test_type()
|
|||||||
call assert_equal(v:t_list, type(v:_null_list))
|
call assert_equal(v:t_list, type(v:_null_list))
|
||||||
call assert_equal(v:t_dict, type(v:_null_dict))
|
call assert_equal(v:t_dict, type(v:_null_dict))
|
||||||
call assert_equal(v:t_blob, type(v:_null_blob))
|
call assert_equal(v:t_blob, type(v:_null_blob))
|
||||||
|
|
||||||
|
call assert_equal(0, 0 + v:false)
|
||||||
|
call assert_equal(1, 0 + v:true)
|
||||||
|
" call assert_equal(0, 0 + v:none)
|
||||||
|
call assert_equal(0, 0 + v:null)
|
||||||
|
|
||||||
|
call assert_equal('false', '' . v:false)
|
||||||
|
call assert_equal('true', '' . v:true)
|
||||||
|
" call assert_equal('none', '' . v:none)
|
||||||
|
call assert_equal('null', '' . v:null)
|
||||||
|
|
||||||
|
call assert_true(v:false == 0)
|
||||||
|
call assert_false(v:false != 0)
|
||||||
|
call assert_true(v:true == 1)
|
||||||
|
call assert_false(v:true != 1)
|
||||||
|
call assert_false(v:true == v:false)
|
||||||
|
call assert_true(v:true != v:false)
|
||||||
|
|
||||||
|
call assert_true(v:null == 0)
|
||||||
|
call assert_false(v:null != 0)
|
||||||
|
" call assert_true(v:none == 0)
|
||||||
|
" call assert_false(v:none != 0)
|
||||||
|
|
||||||
|
call assert_true(v:false is v:false)
|
||||||
|
call assert_true(v:true is v:true)
|
||||||
|
" call assert_true(v:none is v:none)
|
||||||
|
call assert_true(v:null is v:null)
|
||||||
|
|
||||||
|
call assert_false(v:false isnot v:false)
|
||||||
|
call assert_false(v:true isnot v:true)
|
||||||
|
" call assert_false(v:none isnot v:none)
|
||||||
|
call assert_false(v:null isnot v:null)
|
||||||
|
|
||||||
|
call assert_false(v:false is 0)
|
||||||
|
call assert_false(v:true is 1)
|
||||||
|
call assert_false(v:true is v:false)
|
||||||
|
" call assert_false(v:none is 0)
|
||||||
|
call assert_false(v:null is 0)
|
||||||
|
" call assert_false(v:null is v:none)
|
||||||
|
|
||||||
|
call assert_true(v:false isnot 0)
|
||||||
|
call assert_true(v:true isnot 1)
|
||||||
|
call assert_true(v:true isnot v:false)
|
||||||
|
" call assert_true(v:none isnot 0)
|
||||||
|
call assert_true(v:null isnot 0)
|
||||||
|
" call assert_true(v:null isnot v:none)
|
||||||
|
|
||||||
|
call assert_equal(v:false, eval(string(v:false)))
|
||||||
|
call assert_equal(v:true, eval(string(v:true)))
|
||||||
|
" call assert_equal(v:none, eval(string(v:none)))
|
||||||
|
call assert_equal(v:null, eval(string(v:null)))
|
||||||
|
|
||||||
|
call assert_equal(v:false, copy(v:false))
|
||||||
|
call assert_equal(v:true, copy(v:true))
|
||||||
|
" call assert_equal(v:none, copy(v:none))
|
||||||
|
call assert_equal(v:null, copy(v:null))
|
||||||
|
|
||||||
|
call assert_equal([v:false], deepcopy([v:false]))
|
||||||
|
call assert_equal([v:true], deepcopy([v:true]))
|
||||||
|
" call assert_equal([v:none], deepcopy([v:none]))
|
||||||
|
call assert_equal([v:null], deepcopy([v:null]))
|
||||||
|
|
||||||
|
call assert_true(empty(v:false))
|
||||||
|
call assert_false(empty(v:true))
|
||||||
|
call assert_true(empty(v:null))
|
||||||
|
" call assert_true(empty(v:none))
|
||||||
|
|
||||||
|
func ChangeYourMind()
|
||||||
|
try
|
||||||
|
return v:true
|
||||||
|
finally
|
||||||
|
return 'something else'
|
||||||
|
endtry
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
call ChangeYourMind()
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
|
@ -575,7 +575,7 @@ func Test_winrestcmd()
|
|||||||
only
|
only
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! Fun_RenewFile()
|
func Fun_RenewFile()
|
||||||
" Need to wait a bit for the timestamp to be older.
|
" Need to wait a bit for the timestamp to be older.
|
||||||
let old_ftime = getftime("tmp.txt")
|
let old_ftime = getftime("tmp.txt")
|
||||||
while getftime("tmp.txt") == old_ftime
|
while getftime("tmp.txt") == old_ftime
|
||||||
@ -585,7 +585,7 @@ function! Fun_RenewFile()
|
|||||||
sp
|
sp
|
||||||
wincmd p
|
wincmd p
|
||||||
edit! tmp.txt
|
edit! tmp.txt
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_window_prevwin()
|
func Test_window_prevwin()
|
||||||
" Can we make this work on MS-Windows?
|
" Can we make this work on MS-Windows?
|
||||||
|
@ -666,7 +666,7 @@ describe('eval', function()
|
|||||||
source([[
|
source([[
|
||||||
" Vim script used in test_eval.in. Needed for script-local function.
|
" Vim script used in test_eval.in. Needed for script-local function.
|
||||||
|
|
||||||
func! s:Testje()
|
func s:Testje()
|
||||||
return "foo"
|
return "foo"
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user