To: vim_dev@googlegroups.com Subject: Patch 7.4.2343 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2343 Problem: Too many old style tests. Solution: Turn several into new style tests. (Yegappan Lakshmanan) Files: src/testdir/Make_all.mak, src/testdir/test101.in, src/testdir/test101.ok, src/testdir/test18.in, src/testdir/test18.ok, src/testdir/test2.in, src/testdir/test2.ok, src/testdir/test21.in, src/testdir/test21.ok, src/testdir/test6.in, src/testdir/test6.ok, src/testdir/test_arglist.vim, src/testdir/test_charsearch.vim, src/testdir/test_fnameescape.vim, src/testdir/test_gf.vim, src/testdir/test_hlsearch.vim, src/testdir/test_smartindent.vim, src/testdir/test_tagjump.vim, src/Makefile *** ../vim-7.4.2342/src/testdir/Make_all.mak 2016-09-04 19:50:50.520985732 +0200 --- src/testdir/Make_all.mak 2016-09-07 20:37:01.338019898 +0200 *************** *** 13,28 **** 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 \ --- 13,25 ---- *************** *** 74,80 **** test95.out \ test98.out \ test99.out \ - test101.out \ test103.out \ test104.out \ test107.out \ --- 71,76 ---- *************** *** 109,115 **** # Tests that run on most systems, but not on Amiga and DOS/Windows. SCRIPTS_MORE2 = \ - test2.out \ test12.out \ test25.out \ test49.out \ --- 105,110 ---- *************** *** 147,153 **** # Keep test_alot*.res as the last one, sort the others. NEW_TESTS = test_arglist.res \ test_assert.res \ ! test_autochdir \ test_backspace_opt.res \ test_bufwintabinfo.res \ test_cdo.res \ --- 142,148 ---- # Keep test_alot*.res as the last one, sort the others. NEW_TESTS = test_arglist.res \ test_assert.res \ ! test_autochdir.res \ test_backspace_opt.res \ test_bufwintabinfo.res \ test_cdo.res \ *************** *** 159,168 **** --- 154,165 ---- 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,185 **** --- 177,183 ---- test_ruby.res \ test_search.res \ test_signs.res \ + test_smartindent.res \ test_startup.res \ test_startup_utf8.res \ test_stat.res \ *** ../vim-7.4.2342/src/testdir/test101.in 2014-11-27 19:14:45.080940970 +0100 --- src/testdir/test101.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,48 **** - 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: --- 0 ---- *** ../vim-7.4.2342/src/testdir/test101.ok 2016-03-12 19:33:43.426403392 +0100 --- src/testdir/test101.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,12 **** - 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: --- 0 ---- *** ../vim-7.4.2342/src/testdir/test18.in 2010-05-15 13:04:10.000000000 +0200 --- src/testdir/test18.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,16 **** - 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 --- 0 ---- *** ../vim-7.4.2342/src/testdir/test18.ok 2010-05-15 13:04:10.000000000 +0200 --- src/testdir/test18.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,4 **** - start text - #test - test text - test text --- 0 ---- *** ../vim-7.4.2342/src/testdir/test2.in 2010-05-15 13:04:10.000000000 +0200 --- src/testdir/test2.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,29 **** - - 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("")) - /^second - /URL - :call append(1, expand("")) - :if has("ebcdic") - : set isf=@,240-249,/,.,-,_,+,,,$,:,~,\ - :else - : set isf=@,48-57,/,.,-,_,+,,,$,:,~,\ - :endif - /^third - /name - :call append(2, expand("")) - /^fourth - /URL - :call append(3, expand("")) - 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 --- 0 ---- *** ../vim-7.4.2342/src/testdir/test2.ok 2010-05-15 13:04:10.000000000 +0200 --- src/testdir/test2.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,4 **** - URL://machine.name/tmp/vimtest2a - URL://machine.name/tmp/vimtest2b - URL:\\machine.name\vimtest2c - URL:\\machine.name\tmp\vimtest2d --- 0 ---- *** ../vim-7.4.2342/src/testdir/test21.in 2010-05-15 13:04:10.000000000 +0200 --- src/testdir/test21.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,19 **** - 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 --- 0 ---- *** ../vim-7.4.2342/src/testdir/test21.ok 2010-05-15 13:04:10.000000000 +0200 --- src/testdir/test21.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,2 **** - start OK if found this line - start OK if found this line --- 0 ---- *** ../vim-7.4.2342/src/testdir/test6.in 2010-05-15 13:04:10.000000000 +0200 --- src/testdir/test6.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,24 **** - 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 --- 0 ---- *** ../vim-7.4.2342/src/testdir/test6.ok 2010-05-15 13:04:10.000000000 +0200 --- src/testdir/test6.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,18 **** - 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 --- 0 ---- *** ../vim-7.4.2342/src/testdir/test_arglist.vim 2016-01-23 23:02:30.252636325 +0100 --- src/testdir/test_arglist.vim 2016-09-07 20:37:01.338019898 +0200 *************** *** 287,289 **** --- 287,318 ---- 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 *** ../vim-7.4.2342/src/testdir/test_charsearch.vim 2016-09-02 19:50:08.436097707 +0200 --- src/testdir/test_charsearch.vim 2016-09-07 20:37:01.338019898 +0200 *************** *** 2,9 **** function! Test_charsearch() enew! call append(0, ['Xabcdefghijkemnopqretuvwxyz', ! \ 'Yabcdefghijkemnopqretuvwxyz', ! \ 'Zabcdefghijkemnokqretkvwxyz']) " check that "fe" and ";" work 1 normal! ylfep;;p,,p --- 2,9 ---- function! Test_charsearch() enew! call append(0, ['Xabcdefghijkemnopqretuvwxyz', ! \ 'Yabcdefghijkemnopqretuvwxyz', ! \ 'Zabcdefghijkemnokqretkvwxyz']) " check that "fe" and ";" work 1 normal! ylfep;;p,,p *** ../vim-7.4.2342/src/testdir/test_fnameescape.vim 2016-09-02 19:50:08.436097707 +0200 --- src/testdir/test_fnameescape.vim 2016-09-07 20:37:01.338019898 +0200 *************** *** 6,12 **** try exe "w! " . fnameescape(fname) let status = v:true ! endtry call assert_true(status, "Space") call delete(fname) --- 6,12 ---- try exe "w! " . fnameescape(fname) let status = v:true ! endtry call assert_true(status, "Space") call delete(fname) *** ../vim-7.4.2342/src/testdir/test_gf.vim 2016-09-07 20:45:25.365833759 +0200 --- src/testdir/test_gf.vim 2016-09-07 20:37:01.338019898 +0200 *************** *** 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("")) + call search("^second") + call search("URL") + call assert_equal("URL://machine.name/tmp/vimtest2b", expand("")) + 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("")) + call search("^fourth") + call search("URL") + call assert_equal("URL:\\\\machine.name\\tmp\\vimtest2d", expand("")) + + set isf&vim + enew! + endfunction *** ../vim-7.4.2342/src/testdir/test_hlsearch.vim 2016-09-07 20:45:25.369833726 +0200 --- src/testdir/test_hlsearch.vim 2016-09-07 20:37:01.338019898 +0200 *************** *** 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\" | 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! /\" | redraw + call assert_equal(r1, screenattr(1,1)) + set nohls + exe "normal! /\" | redraw + call assert_notequal(r1, screenattr(1,1)) + call assert_fails('let v:hlsearch=[]', 'E745') + call garbagecollect(1) + call getchar(1) + enew! + endfunction *** ../vim-7.4.2342/src/testdir/test_smartindent.vim 2016-09-07 20:45:25.377833660 +0200 --- src/testdir/test_smartindent.vim 2016-09-07 20:37:01.338019898 +0200 *************** *** 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\" + exe "normal! 2cc#test\" + call assert_equal(" #test", getline(1)) + enew! | close + endfunction *** ../vim-7.4.2342/src/testdir/test_tagjump.vim 2016-08-24 21:21:22.572601394 +0200 --- src/testdir/test_tagjump.vim 2016-09-07 20:37:01.338019898 +0200 *************** *** 23,26 **** --- 23,56 ---- 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[\" + call assert_equal(" start OK if found this line", getline('.')) + call cursor(1,1) + call search("start") + exe "normal! 5\\" + 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 *** ../vim-7.4.2342/src/Makefile 2016-09-04 19:50:50.524985699 +0200 --- src/Makefile 2016-09-07 20:39:12.952926519 +0200 *************** *** 2041,2047 **** test_search_mbyte \ test_utf8 \ test_wordcount \ ! test2 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 \ --- 2041,2047 ---- test_search_mbyte \ test_utf8 \ test_wordcount \ ! 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,2096 **** --- 2085,2098 ---- 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,2133 **** --- 2130,2136 ---- test_signs \ test_sort \ test_source_utf8 \ + test_smartindent \ test_startup \ test_startup_utf8 \ test_stat \ *** ../vim-7.4.2342/src/version.c 2016-09-06 23:23:46.389460230 +0200 --- src/version.c 2016-09-07 20:39:28.180800027 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2343, /**/ -- hundred-and-one symptoms of being an internet addict: 190. You quickly hand over your wallet, leather jacket, and car keys during a mugging, then proceed to beat the crap out of your assailant when he asks for your laptop. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///