diff options
| -rw-r--r-- | src/nvim/testdir/Makefile | 3 | ||||
| -rw-r--r-- | src/nvim/testdir/test_charsearch.vim | 62 | ||||
| -rw-r--r-- | src/nvim/testdir/test_fnameescape.vim | 21 | ||||
| -rw-r--r-- | src/nvim/testdir/test_substitute.vim | 41 | ||||
| -rw-r--r-- | src/nvim/version.c | 2 | 
5 files changed, 128 insertions, 1 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 531a07912f..fd557cca51 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -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 \ diff --git a/src/nvim/testdir/test_charsearch.vim b/src/nvim/testdir/test_charsearch.vim new file mode 100644 index 0000000000..115659a013 --- /dev/null +++ b/src/nvim/testdir/test_charsearch.vim @@ -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 diff --git a/src/nvim/testdir/test_fnameescape.vim b/src/nvim/testdir/test_fnameescape.vim new file mode 100644 index 0000000000..ce2cd3f7a6 --- /dev/null +++ b/src/nvim/testdir/test_fnameescape.vim @@ -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 diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim new file mode 100644 index 0000000000..e2b6de03c3 --- /dev/null +++ b/src/nvim/testdir/test_substitute.vim @@ -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 diff --git a/src/nvim/version.c b/src/nvim/version.c index a911e8ebc3..ee66b00b4e 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -134,7 +134,7 @@ static int included_patches[] = {    // 2310 NA    2309,    // 2308 NA -  // 2307, +  2307,    // 2306,    2305,    // 2304 NA  | 
