diff options
-rw-r--r-- | src/Makefile | 5 | ||||
-rw-r--r-- | src/testdir/Make_all.mak | 10 | ||||
-rw-r--r-- | src/testdir/test101.in | 48 | ||||
-rw-r--r-- | src/testdir/test101.ok | 12 | ||||
-rw-r--r-- | src/testdir/test18.in | 16 | ||||
-rw-r--r-- | src/testdir/test18.ok | 4 | ||||
-rw-r--r-- | src/testdir/test2.in | 29 | ||||
-rw-r--r-- | src/testdir/test2.ok | 4 | ||||
-rw-r--r-- | src/testdir/test21.in | 19 | ||||
-rw-r--r-- | src/testdir/test21.ok | 2 | ||||
-rw-r--r-- | src/testdir/test6.in | 24 | ||||
-rw-r--r-- | src/testdir/test6.ok | 18 | ||||
-rw-r--r-- | src/testdir/test_arglist.vim | 29 | ||||
-rw-r--r-- | src/testdir/test_charsearch.vim | 4 | ||||
-rw-r--r-- | src/testdir/test_fnameescape.vim | 2 | ||||
-rw-r--r-- | src/testdir/test_gf.vim | 33 | ||||
-rw-r--r-- | src/testdir/test_hlsearch.vim | 34 | ||||
-rw-r--r-- | src/testdir/test_smartindent.vim | 14 | ||||
-rw-r--r-- | src/testdir/test_tagjump.vim | 30 | ||||
-rw-r--r-- | src/version.c | 2 |
20 files changed, 153 insertions, 186 deletions
diff --git a/src/Makefile b/src/Makefile index a56aa04e6c..79d7a9c4ad 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2041,7 +2041,7 @@ test1 \ test_search_mbyte \ test_utf8 \ test_wordcount \ - test2 test3 test4 test5 test6 test7 test8 test9 \ + test3 test4 test5 test6 test7 test8 test9 \ test11 test12 test14 test15 test17 test18 test19 \ test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \ test30 test31 test32 test33 test34 test36 test37 test38 test39 \ @@ -2085,12 +2085,14 @@ test_arglist \ test_fnameescape \ test_fnamemodify \ test_glob2regpat \ + test_gf \ test_gn \ test_goto \ test_gui \ test_hardcopy \ test_help_tagjump \ test_history \ + test_hlsearch \ test_increment \ test_increment_dbcs \ test_job_fails \ @@ -2128,6 +2130,7 @@ test_arglist \ test_signs \ test_sort \ test_source_utf8 \ + test_smartindent \ test_startup \ test_startup_utf8 \ test_stat \ diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 5a7099337d..65ad3ee12f 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -13,16 +13,13 @@ SCRIPTS_ALL = \ test3.out \ test4.out \ test5.out \ - test6.out \ test7.out \ test8.out \ test9.out \ test14.out \ test15.out \ - test18.out \ test19.out \ test20.out \ - test21.out \ test22.out \ test23.out \ test24.out \ @@ -74,7 +71,6 @@ SCRIPTS_ALL = \ test95.out \ test98.out \ test99.out \ - test101.out \ test103.out \ test104.out \ test107.out \ @@ -109,7 +105,6 @@ SCRIPTS_MORE1 = \ # Tests that run on most systems, but not on Amiga and DOS/Windows. SCRIPTS_MORE2 = \ - test2.out \ test12.out \ test25.out \ test49.out \ @@ -147,7 +142,7 @@ SCRIPTS_GUI = # Keep test_alot*.res as the last one, sort the others. NEW_TESTS = test_arglist.res \ test_assert.res \ - test_autochdir \ + test_autochdir.res \ test_backspace_opt.res \ test_bufwintabinfo.res \ test_cdo.res \ @@ -159,10 +154,12 @@ NEW_TESTS = test_arglist.res \ test_digraph.res \ test_farsi.res \ test_fnameescape.res \ + test_gf.res \ test_gn.res \ test_gui.res \ test_hardcopy.res \ test_history.res \ + test_hlsearch.res \ test_increment.res \ test_increment_dbcs.res \ test_job_fails.res \ @@ -180,6 +177,7 @@ NEW_TESTS = test_arglist.res \ test_ruby.res \ test_search.res \ test_signs.res \ + test_smartindent.res \ test_startup.res \ test_startup_utf8.res \ test_stat.res \ diff --git a/src/testdir/test101.in b/src/testdir/test101.in deleted file mode 100644 index 31fc334393..0000000000 --- a/src/testdir/test101.in +++ /dev/null @@ -1,48 +0,0 @@ -Test for v:hlsearch vim: set ft=vim : - -STARTTEST -:" Last abc: Q -:so small.vim -:new -:call setline(1, repeat(['aaa'], 10)) -:set hlsearch nolazyredraw -:let r=[] -:command -nargs=0 -bar AddR :call add(r, [screenattr(1, 1), v:hlsearch]) -/aaa -:AddR -:nohlsearch -:AddR -:let v:hlsearch=1 -:AddR -:let v:hlsearch=0 -:AddR -:set hlsearch -:AddR -:let v:hlsearch=0 -:AddR -n:AddR -:let v:hlsearch=0 -:AddR -/ -:AddR -:set nohls -/ -:AddR -:let r1=r[0][0] -:" I guess it is not guaranteed that screenattr outputs always the same character -:call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")') -:try -: let v:hlsearch=[] -:catch -: call add(r, matchstr(v:exception,'^Vim(let):E\d\+:')) -:endtry -:bwipeout! -:$put=r -:call garbagecollect(1) -:" -:/^start:/,$wq! test.out -:" vim: et ts=4 isk-=\: -:call getchar() -ENDTEST - -start: diff --git a/src/testdir/test101.ok b/src/testdir/test101.ok deleted file mode 100644 index 86aa73b205..0000000000 --- a/src/testdir/test101.ok +++ /dev/null @@ -1,12 +0,0 @@ -start: -1:highlighted -0:not highlighted -1:highlighted -0:not highlighted -1:highlighted -0:not highlighted -1:highlighted -0:not highlighted -1:highlighted -0:not highlighted -Vim(let):E745: diff --git a/src/testdir/test18.in b/src/testdir/test18.in deleted file mode 100644 index 9bfd922344..0000000000 --- a/src/testdir/test18.in +++ /dev/null @@ -1,16 +0,0 @@ -Tests for not doing smart indenting when it isn't set. - -STARTTEST -:so small.vim -:set nocin nosi ai -/some -2cc#test -:?start?,$w! test.out -:qa! -ENDTEST - -start text - some test text - test text -test text - test text diff --git a/src/testdir/test18.ok b/src/testdir/test18.ok deleted file mode 100644 index e719713785..0000000000 --- a/src/testdir/test18.ok +++ /dev/null @@ -1,4 +0,0 @@ -start text - #test -test text - test text diff --git a/src/testdir/test2.in b/src/testdir/test2.in deleted file mode 100644 index b7b5a51066..0000000000 --- a/src/testdir/test2.in +++ /dev/null @@ -1,29 +0,0 @@ - -This is a test if a URL is recognized by "gf", with the cursor before and -after the "://". Also test ":\\". - -STARTTEST -:so small.vim -/^first -/tmp -:call append(0, expand("<cfile>")) -/^second -/URL -:call append(1, expand("<cfile>")) -:if has("ebcdic") -: set isf=@,240-249,/,.,-,_,+,,,$,:,~,\ -:else -: set isf=@,48-57,/,.,-,_,+,,,$,:,~,\ -:endif -/^third -/name -:call append(2, expand("<cfile>")) -/^fourth -/URL -:call append(3, expand("<cfile>")) -5GdG:wq! test.out -ENDTEST -first test for URL://machine.name/tmp/vimtest2a and other text -second test for URL://machine.name/tmp/vimtest2b. And other text -third test for URL:\\machine.name\vimtest2c and other text -fourth test for URL:\\machine.name\tmp\vimtest2d, and other text diff --git a/src/testdir/test2.ok b/src/testdir/test2.ok deleted file mode 100644 index 32978825f8..0000000000 --- a/src/testdir/test2.ok +++ /dev/null @@ -1,4 +0,0 @@ -URL://machine.name/tmp/vimtest2a -URL://machine.name/tmp/vimtest2b -URL:\\machine.name\vimtest2c -URL:\\machine.name\tmp\vimtest2d diff --git a/src/testdir/test21.in b/src/testdir/test21.in deleted file mode 100644 index 491b9f7404..0000000000 --- a/src/testdir/test21.in +++ /dev/null @@ -1,19 +0,0 @@ -Tests for [ CTRL-I with a count and CTRL-W CTRL-I with a count - -STARTTEST -:so small.vim -/start -6[ :.w! test.out -?start here -6 :.w >>test.out -:qa! -ENDTEST - -#include test21.in - -/* test text test tex start here - some text - test text - start OK if found this line - start found wrong line -test text diff --git a/src/testdir/test21.ok b/src/testdir/test21.ok deleted file mode 100644 index d9f1b759ce..0000000000 --- a/src/testdir/test21.ok +++ /dev/null @@ -1,2 +0,0 @@ - start OK if found this line - start OK if found this line diff --git a/src/testdir/test6.in b/src/testdir/test6.in deleted file mode 100644 index 1ebbe2fa51..0000000000 --- a/src/testdir/test6.in +++ /dev/null @@ -1,24 +0,0 @@ -Test for autocommand that redefines the argument list, when doing ":all". - -STARTTEST -:so small.vim -:au BufReadPost Xxx2 next Xxx2 Xxx1 -/^start of -A1:.,/end of/w! Xxx1 " write test file Xxx1 -$r2:.,/end of/w! Xxx2 " write test file Xxx2 -$r3:.,/end of/w! Xxx3 " write test file Xxx3 -:next! Xxx1 Xxx2 Xxx3 " redefine arglist; go to Xxx1 -:all " open window for all args -:w! test.out " Write contents of Xxx1 -:w >>test.out " Append contents of last window (Xxx1) -:rew " should now be in Xxx2 -:w >>test.out " Append contents of Xxx2 -:qa! -ENDTEST - -start of test file Xxx - this is a test - this is a test - this is a test - this is a test -end of test file Xxx diff --git a/src/testdir/test6.ok b/src/testdir/test6.ok deleted file mode 100644 index b6b0c93e4e..0000000000 --- a/src/testdir/test6.ok +++ /dev/null @@ -1,18 +0,0 @@ -start of test file Xxx1 - this is a test - this is a test - this is a test - this is a test -end of test file Xxx -start of test file Xxx1 - this is a test - this is a test - this is a test - this is a test -end of test file Xxx -start of test file Xxx2 - this is a test - this is a test - this is a test - this is a test -end of test file Xxx diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim index 4244344270..0caead8482 100644 --- a/src/testdir/test_arglist.vim +++ b/src/testdir/test_arglist.vim @@ -287,3 +287,32 @@ function Test_argpos() call assert_equal(0, argidx()) %argd endfunction + +" Test for autocommand that redefines the argument list, when doing ":all". +function Test_arglist_autocmd() + autocmd BufReadPost Xxx2 next Xxx2 Xxx1 + call writefile(['test file Xxx1'], 'Xxx1') + call writefile(['test file Xxx2'], 'Xxx2') + call writefile(['test file Xxx3'], 'Xxx3') + + new + " redefine arglist; go to Xxx1 + next! Xxx1 Xxx2 Xxx3 + " open window for all args + all + call assert_equal('test file Xxx1', getline(1)) + wincmd w + wincmd w + call assert_equal('test file Xxx1', getline(1)) + " should now be in Xxx2 + rewind + call assert_equal('test file Xxx2', getline(1)) + + autocmd! BufReadPost Xxx2 + enew! | only + call delete('Xxx1') + call delete('Xxx2') + call delete('Xxx3') + argdelete Xxx* + bwipe! Xxx1 Xxx2 Xxx3 +endfunction diff --git a/src/testdir/test_charsearch.vim b/src/testdir/test_charsearch.vim index 115659a013..8b313b5a35 100644 --- a/src/testdir/test_charsearch.vim +++ b/src/testdir/test_charsearch.vim @@ -2,8 +2,8 @@ function! Test_charsearch() enew! call append(0, ['Xabcdefghijkemnopqretuvwxyz', - \ 'Yabcdefghijkemnopqretuvwxyz', - \ 'Zabcdefghijkemnokqretkvwxyz']) + \ 'Yabcdefghijkemnopqretuvwxyz', + \ 'Zabcdefghijkemnokqretkvwxyz']) " check that "fe" and ";" work 1 normal! ylfep;;p,,p diff --git a/src/testdir/test_fnameescape.vim b/src/testdir/test_fnameescape.vim index ce2cd3f7a6..cdff0dfbd9 100644 --- a/src/testdir/test_fnameescape.vim +++ b/src/testdir/test_fnameescape.vim @@ -6,7 +6,7 @@ function! Test_fnameescape() try exe "w! " . fnameescape(fname) let status = v:true - endtry + endtry call assert_true(status, "Space") call delete(fname) diff --git a/src/testdir/test_gf.vim b/src/testdir/test_gf.vim new file mode 100644 index 0000000000..c4aa6f9218 --- /dev/null +++ b/src/testdir/test_gf.vim @@ -0,0 +1,33 @@ + +" This is a test if a URL is recognized by "gf", with the cursor before and +" after the "://". Also test ":\\". +function! Test_gf_url() + enew! + call append(0, [ + \ "first test for URL://machine.name/tmp/vimtest2a and other text", + \ "second test for URL://machine.name/tmp/vimtest2b. And other text", + \ "third test for URL:\\\\machine.name\\vimtest2c and other text", + \ "fourth test for URL:\\\\machine.name\\tmp\\vimtest2d, and other text" + \ ]) + call cursor(1,1) + call search("^first") + call search("tmp") + call assert_equal("URL://machine.name/tmp/vimtest2a", expand("<cfile>")) + call search("^second") + call search("URL") + call assert_equal("URL://machine.name/tmp/vimtest2b", expand("<cfile>")) + if has("ebcdic") + set isf=@,240-249,/,.,-,_,+,,,$,:,~,\ + else + set isf=@,48-57,/,.,-,_,+,,,$,:,~,\ + endif + call search("^third") + call search("name") + call assert_equal("URL:\\\\machine.name\\vimtest2c", expand("<cfile>")) + call search("^fourth") + call search("URL") + call assert_equal("URL:\\\\machine.name\\tmp\\vimtest2d", expand("<cfile>")) + + set isf&vim + enew! +endfunction diff --git a/src/testdir/test_hlsearch.vim b/src/testdir/test_hlsearch.vim new file mode 100644 index 0000000000..066fdd0250 --- /dev/null +++ b/src/testdir/test_hlsearch.vim @@ -0,0 +1,34 @@ +" Test for v:hlsearch + +function! Test_hlsearch() + new + call setline(1, repeat(['aaa'], 10)) + set hlsearch nolazyredraw + let r=[] + " redraw is needed to make hlsearch highlight the matches + exe "normal! /aaa\<CR>" | redraw + let r1 = screenattr(1, 1) + nohlsearch | redraw + call assert_notequal(r1, screenattr(1,1)) + let v:hlsearch=1 | redraw + call assert_equal(r1, screenattr(1,1)) + let v:hlsearch=0 | redraw + call assert_notequal(r1, screenattr(1,1)) + set hlsearch | redraw + call assert_equal(r1, screenattr(1,1)) + let v:hlsearch=0 | redraw + call assert_notequal(r1, screenattr(1,1)) + exe "normal! n" | redraw + call assert_equal(r1, screenattr(1,1)) + let v:hlsearch=0 | redraw + call assert_notequal(r1, screenattr(1,1)) + exe "normal! /\<CR>" | redraw + call assert_equal(r1, screenattr(1,1)) + set nohls + exe "normal! /\<CR>" | redraw + call assert_notequal(r1, screenattr(1,1)) + call assert_fails('let v:hlsearch=[]', 'E745') + call garbagecollect(1) + call getchar(1) + enew! +endfunction diff --git a/src/testdir/test_smartindent.vim b/src/testdir/test_smartindent.vim new file mode 100644 index 0000000000..d00eac9798 --- /dev/null +++ b/src/testdir/test_smartindent.vim @@ -0,0 +1,14 @@ + +" Tests for not doing smart indenting when it isn't set. +function! Test_nosmartindent() + new + call append(0, [" some test text", + \ " test text", + \ "test text", + \ " test text"]) + set nocindent nosmartindent autoindent + exe "normal! gg/some\<CR>" + exe "normal! 2cc#test\<Esc>" + call assert_equal(" #test", getline(1)) + enew! | close +endfunction diff --git a/src/testdir/test_tagjump.vim b/src/testdir/test_tagjump.vim index 678ad0ada8..11ec144f63 100644 --- a/src/testdir/test_tagjump.vim +++ b/src/testdir/test_tagjump.vim @@ -23,4 +23,34 @@ func Test_cancel_ptjump() quit endfunc +" Tests for [ CTRL-I and CTRL-W CTRL-I commands +function Test_keyword_jump() + call writefile(["#include Xinclude", "", + \ "", + \ "/* test text test tex start here", + \ " some text", + \ " test text", + \ " start OK if found this line", + \ " start found wrong line", + \ "test text"], 'Xtestfile') + call writefile(["/* test text test tex start here", + \ " some text", + \ " test text", + \ " start OK if found this line", + \ " start found wrong line", + \ "test text"], 'Xinclude') + new Xtestfile + call cursor(1,1) + call search("start") + exe "normal! 5[\<C-I>" + call assert_equal(" start OK if found this line", getline('.')) + call cursor(1,1) + call search("start") + exe "normal! 5\<C-W>\<C-I>" + call assert_equal(" start OK if found this line", getline('.')) + enew! | only + call delete('Xtestfile') + call delete('Xinclude') +endfunction + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index c870edd7e5..726089b880 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2343, +/**/ 2342, /**/ 2341, |