mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.2307
Problem: Several tests are old style.
Solution: Turn them into new style tests. (Yegappan Lakshmanan)
cd055da370
This commit is contained in:
parent
edc80f6b46
commit
20e7652b69
@ -30,6 +30,7 @@ SCRIPTS ?= \
|
||||
NEW_TESTS ?= \
|
||||
test_autocmd.res \
|
||||
test_bufwintabinfo.res \
|
||||
test_charsearch.res \
|
||||
test_cmdline.res \
|
||||
test_command_count.res \
|
||||
test_cscope.res \
|
||||
@ -37,6 +38,7 @@ NEW_TESTS ?= \
|
||||
test_diffmode.res \
|
||||
test_farsi.res \
|
||||
test_filter_map.res \
|
||||
test_fnameescape.res \
|
||||
test_fold.res \
|
||||
test_glob2regpat.res \
|
||||
test_gn.res \
|
||||
@ -55,6 +57,7 @@ NEW_TESTS ?= \
|
||||
test_normal.res \
|
||||
test_quickfix.res \
|
||||
test_signs.res \
|
||||
test_substitute.res \
|
||||
test_syntax.res \
|
||||
test_tabpage.res \
|
||||
test_textobjects.res \
|
||||
|
62
src/nvim/testdir/test_charsearch.vim
Normal file
62
src/nvim/testdir/test_charsearch.vim
Normal file
@ -0,0 +1,62 @@
|
||||
|
||||
function! Test_charsearch()
|
||||
enew!
|
||||
call append(0, ['Xabcdefghijkemnopqretuvwxyz',
|
||||
\ 'Yabcdefghijkemnopqretuvwxyz',
|
||||
\ 'Zabcdefghijkemnokqretkvwxyz'])
|
||||
" check that "fe" and ";" work
|
||||
1
|
||||
normal! ylfep;;p,,p
|
||||
call assert_equal('XabcdeXfghijkeXmnopqreXtuvwxyz', getline(1))
|
||||
" check that save/restore works
|
||||
2
|
||||
normal! ylfep
|
||||
let csave = getcharsearch()
|
||||
normal! fip
|
||||
call setcharsearch(csave)
|
||||
normal! ;p;p
|
||||
call assert_equal('YabcdeYfghiYjkeYmnopqreYtuvwxyz', getline(2))
|
||||
|
||||
" check that setcharsearch() changes the settings.
|
||||
3
|
||||
normal! ylfep
|
||||
call setcharsearch({'char': 'k'})
|
||||
normal! ;p
|
||||
call setcharsearch({'forward': 0})
|
||||
normal! $;p
|
||||
call setcharsearch({'until': 1})
|
||||
set cpo-=;
|
||||
normal! ;;p
|
||||
call assert_equal('ZabcdeZfghijkZZemnokqretkZvwxyz', getline(3))
|
||||
enew!
|
||||
endfunction
|
||||
|
||||
" Test for t,f,F,T movement commands and 'cpo-;' setting
|
||||
function! Test_search_cmds()
|
||||
enew!
|
||||
call append(0, ["aaa two three four", " zzz", "yyy ",
|
||||
\ "bbb yee yoo four", "ccc two three four",
|
||||
\ "ddd yee yoo four"])
|
||||
set cpo-=;
|
||||
1
|
||||
normal! 0tt;D
|
||||
2
|
||||
normal! 0fz;D
|
||||
3
|
||||
normal! $Fy;D
|
||||
4
|
||||
normal! $Ty;D
|
||||
set cpo+=;
|
||||
5
|
||||
normal! 0tt;;D
|
||||
6
|
||||
normal! $Ty;;D
|
||||
|
||||
call assert_equal('aaa two', getline(1))
|
||||
call assert_equal(' z', getline(2))
|
||||
call assert_equal('y', getline(3))
|
||||
call assert_equal('bbb y', getline(4))
|
||||
call assert_equal('ccc', getline(5))
|
||||
call assert_equal('ddd yee y', getline(6))
|
||||
enew!
|
||||
endfunction
|
21
src/nvim/testdir/test_fnameescape.vim
Normal file
21
src/nvim/testdir/test_fnameescape.vim
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
" Test if fnameescape is correct for special chars like !
|
||||
function! Test_fnameescape()
|
||||
let fname = 'Xspa ce'
|
||||
let status = v:false
|
||||
try
|
||||
exe "w! " . fnameescape(fname)
|
||||
let status = v:true
|
||||
endtry
|
||||
call assert_true(status, "Space")
|
||||
call delete(fname)
|
||||
|
||||
let fname = 'Xemark!'
|
||||
let status = v:false
|
||||
try
|
||||
exe "w! " . fnameescape(fname)
|
||||
let status = v:true
|
||||
endtry
|
||||
call assert_true(status, "ExclamationMark")
|
||||
call delete(fname)
|
||||
endfunction
|
41
src/nvim/testdir/test_substitute.vim
Normal file
41
src/nvim/testdir/test_substitute.vim
Normal file
@ -0,0 +1,41 @@
|
||||
" Tests for multi-line regexps with ":s".
|
||||
|
||||
function! Test_multiline_subst()
|
||||
enew!
|
||||
call append(0, ["1 aa",
|
||||
\ "bb",
|
||||
\ "cc",
|
||||
\ "2 dd",
|
||||
\ "ee",
|
||||
\ "3 ef",
|
||||
\ "gh",
|
||||
\ "4 ij",
|
||||
\ "5 a8",
|
||||
\ "8b c9",
|
||||
\ "9d",
|
||||
\ "6 e7",
|
||||
\ "77f",
|
||||
\ "xxxxx"])
|
||||
|
||||
1
|
||||
" test if replacing a line break works with a back reference
|
||||
/^1/,/^2/s/\n\(.\)/ \1/
|
||||
" test if inserting a line break works with a back reference
|
||||
/^3/,/^4/s/\(.\)$/\r\1/
|
||||
" test if replacing a line break with another line break works
|
||||
/^5/,/^6/s/\(\_d\{3}\)/x\1x/
|
||||
call assert_equal('1 aa bb cc 2 dd ee', getline(1))
|
||||
call assert_equal('3 e', getline(2))
|
||||
call assert_equal('f', getline(3))
|
||||
call assert_equal('g', getline(4))
|
||||
call assert_equal('h', getline(5))
|
||||
call assert_equal('4 i', getline(6))
|
||||
call assert_equal('j', getline(7))
|
||||
call assert_equal('5 ax8', getline(8))
|
||||
call assert_equal('8xb cx9', getline(9))
|
||||
call assert_equal('9xd', getline(10))
|
||||
call assert_equal('6 ex7', getline(11))
|
||||
call assert_equal('7x7f', getline(12))
|
||||
call assert_equal('xxxxx', getline(13))
|
||||
enew!
|
||||
endfunction
|
@ -134,7 +134,7 @@ static int included_patches[] = {
|
||||
// 2310 NA
|
||||
2309,
|
||||
// 2308 NA
|
||||
// 2307,
|
||||
2307,
|
||||
// 2306,
|
||||
2305,
|
||||
// 2304 NA
|
||||
|
Loading…
Reference in New Issue
Block a user