From 57d7971b5f1621071176eea81cdb0d1fc50c925d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 28 Dec 2015 14:04:47 +0100 Subject: [PATCH 01/10] patch 7.4.980 Problem: Tests for :cdo, :ldo, etc. are outdated. Solution: Add new style tests for these commands. (Yegappan Lakshmanan) --- src/testdir/Make_amiga.mak | 2 - src/testdir/Make_dos.mak | 1 - src/testdir/Make_ming.mak | 1 - src/testdir/Make_os2.mak | 1 - src/testdir/Make_vms.mms | 1 - src/testdir/Makefile | 4 +- src/testdir/test_cdo.in | 108 ------------------- src/testdir/test_cdo.ok | 66 ------------ src/testdir/test_cdo.vim | 206 +++++++++++++++++++++++++++++++++++++ src/version.c | 2 + 10 files changed, 210 insertions(+), 182 deletions(-) delete mode 100644 src/testdir/test_cdo.in delete mode 100644 src/testdir/test_cdo.ok create mode 100644 src/testdir/test_cdo.vim diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index d60f1a1bbe..250209b597 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -41,7 +41,6 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_autocmd_option.out \ test_autoformat_join.out \ test_breakindent.out \ - test_cdo.out \ test_changelist.out \ test_charsearch.out \ test_close_count.out \ @@ -197,7 +196,6 @@ test_argument_count.out: test_argument_count.in test_autocmd_option.out: test_autocmd_option.in test_autoformat_join.out: test_autoformat_join.in test_breakindent.out: test_breakindent.in -test_cdo.out: test_cdo.in test_changelist.out: test_changelist.in test_charsearch.out: test_charsearch.in test_close_count.out: test_close_count.in diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 8dbe97e2f1..5b16874a13 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -40,7 +40,6 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_autocmd_option.out \ test_autoformat_join.out \ test_breakindent.out \ - test_cdo.out \ test_changelist.out \ test_charsearch.out \ test_close_count.out \ diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index a7c98ee8dc..fc9bd93d72 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -62,7 +62,6 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_autocmd_option.out \ test_autoformat_join.out \ test_breakindent.out \ - test_cdo.out \ test_changelist.out \ test_charsearch.out \ test_close_count.out \ diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index 926411b648..8ba54f2182 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -42,7 +42,6 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_autocmd_option.out \ test_autoformat_join.out \ test_breakindent.out \ - test_cdo.out \ test_changelist.out \ test_charsearch.out \ test_close_count.out \ diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 990ae5f572..70ba14876d 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -101,7 +101,6 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \ test_autocmd_option.out \ test_autoformat_join.out \ test_breakindent.out \ - test_cdo.out \ test_changelist.out \ test_charsearch.out \ test_close_count.out \ diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 83350aa638..cb0ec4596b 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -41,7 +41,6 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test_autocmd_option.out \ test_autoformat_join.out \ test_breakindent.out \ - test_cdo.out \ test_changelist.out \ test_charsearch.out \ test_close_count.out \ @@ -72,6 +71,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test_writefile.out NEW_TESTS = test_assert.res \ + test_cdo.res \ test_alot.res SCRIPTS_GUI = test16.out @@ -173,4 +173,4 @@ RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPR newtests: $(NEW_TESTS) .vim.res: - $(RUN_VIMTEST) -u runtest.vim $*.vim + $(RUN_VIMTEST) -S runtest.vim $*.vim diff --git a/src/testdir/test_cdo.in b/src/testdir/test_cdo.in deleted file mode 100644 index 087cd2ea93..0000000000 --- a/src/testdir/test_cdo.in +++ /dev/null @@ -1,108 +0,0 @@ -Tests for the :cdo, :cfdo, :ldo and :lfdo commands - -STARTTEST -:so small.vim -:lang mess C -:if !has('quickfix') | e! test.ok | wq! test.out | endif - -:call writefile(["Line1", "Line2", "Line3"], 'Xtestfile1') -:call writefile(["Line1", "Line2", "Line3"], 'Xtestfile2') -:call writefile(["Line1", "Line2", "Line3"], 'Xtestfile3') - -:function RunTests(cchar) -: let nl="\n" - -: enew -: " Try with an empty list -: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" - -: " Populate the list and then try -: exe a:cchar . "getexpr ['non-error 1', 'Xtestfile1:1:3:Line1', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:3:1:Line3']" -: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" - -: " Run command only on selected error lines -: enew -: exe "2,3" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: " Boundary condition tests -: enew -: exe "1,1" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: enew -: exe "3" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: " Range test commands -: enew -: exe "%" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: enew -: exe "1,$" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: enew -: exe a:cchar . 'prev' -: exe "." . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: " Invalid error lines test -: enew -: exe "27" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "4,5" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" - -: " Run commands from an unsaved buffer -: let v:errmsg='' -: enew -: setlocal modified -: exe "2,2" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: if v:errmsg =~# 'No write since last change' -: let g:result .= 'Unsaved file change test passed' . nl -: else -: let g:result .= 'Unsaved file change test failed' . nl -: endif - -: " If the executed command fails, then the operation should be aborted -: enew! -: let subst_count = 0 -: exe a:cchar . "do s/Line/xLine/ | let subst_count += 1" -: if subst_count == 1 && getline('.') == 'xLine1' -: let g:result .= 'Abort command on error test passed' . nl -: else -: let g:result .= 'Abort command on error test failed' . nl -: endif - -: exe "2,2" . a:cchar . "do! let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" - -: " List with no valid error entries -: edit! +2 Xtestfile1 -: exe a:cchar . "getexpr ['non-error 1', 'non-error 2', 'non-error 3']" -: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "2" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: let v:errmsg='' -: exe "%" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "1,$" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "." . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: let g:result .= v:errmsg - -: " List with only one valid entry -: exe a:cchar . "getexpr ['Xtestfile3:3:1:Line3']" -: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" - -: " Tests for :cfdo and :lfdo commands -: exe a:cchar . "getexpr ['non-error 1', 'Xtestfile1:1:3:Line1', 'Xtestfile1:2:1:Line2', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:2:3:Line2', 'Xtestfile3:3:1:Line3']" -: exe a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "3" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "2,3" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "%" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "1,$" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe a:cchar . 'pfile' -: exe "." . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" - -: " List with only one valid entry -: exe a:cchar . "getexpr ['Xtestfile2:2:5:Line2']" -: exe a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -:endfunction - -:let result='' -:" Tests for the :cdo quickfix list command -:call RunTests('c') -:let result .= "\n" -:" Tests for the :ldo location list command -:call RunTests('l') - -:edit! test.out -:0put =result -:wq! -ENDTEST - diff --git a/src/testdir/test_cdo.ok b/src/testdir/test_cdo.ok deleted file mode 100644 index ddcff4bbb8..0000000000 --- a/src/testdir/test_cdo.ok +++ /dev/null @@ -1,66 +0,0 @@ -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile2 2L 2C -Unsaved file change test passed -Abort command on error test passed -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile3 2L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile2 2L 2C -Xtestfile2 2L 5C - -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile2 2L 2C -Unsaved file change test passed -Abort command on error test passed -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile3 2L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile2 2L 2C -Xtestfile2 2L 5C - diff --git a/src/testdir/test_cdo.vim b/src/testdir/test_cdo.vim new file mode 100644 index 0000000000..10cd97c31f --- /dev/null +++ b/src/testdir/test_cdo.vim @@ -0,0 +1,206 @@ +" Tests for the :cdo, :cfdo, :ldo and :lfdo commands + +lang mess C +if !has('quickfix') + finish +endif + +" Create the files used by the tests +function SetUp() + call writefile(["Line1", "Line2", "Line3"], 'Xtestfile1') + call writefile(["Line1", "Line2", "Line3"], 'Xtestfile2') + call writefile(["Line1", "Line2", "Line3"], 'Xtestfile3') +endfunction + +" Remove the files used by the tests +function TearDown() + call delete('Xtestfile1') + call delete('Xtestfile2') + call delete('Xtestfile3') +endfunction + +" Returns the current line in ' L C' format +function GetRuler() + return expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' +endfunction + +" Tests for the :cdo and :ldo commands +function XdoTests(cchar) + enew + + " Shortcuts for calling the cdo and ldo commands + let Xdo = a:cchar . 'do' + let Xgetexpr = a:cchar . 'getexpr' + let Xprev = a:cchar. 'prev' + let XdoCmd = Xdo . ' call add(l, GetRuler())' + + " Try with an empty list + let l = [] + exe XdoCmd + call assert_equal([], l) + + " Populate the list and then try + exe Xgetexpr . " ['non-error 1', 'Xtestfile1:1:3:Line1', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:3:1:Line3']" + + let l = [] + exe XdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l) + + " Run command only on selected error lines + let l = [] + enew + exe "2,3" . XdoCmd + call assert_equal(['Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l) + + " Boundary condition tests + let l = [] + enew + exe "1,1" . XdoCmd + call assert_equal(['Xtestfile1 1L 3C'], l) + + let l = [] + enew + exe "3" . XdoCmd + call assert_equal(['Xtestfile3 3L 1C'], l) + + " Range test commands + let l = [] + enew + exe "%" . XdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l) + + let l = [] + enew + exe "1,$" . XdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l) + + let l = [] + enew + exe Xprev + exe "." . XdoCmd + call assert_equal(['Xtestfile2 2L 2C'], l) + + let l = [] + enew + exe "+" . XdoCmd + call assert_equal(['Xtestfile3 3L 1C'], l) + + " Invalid error lines test + let l = [] + enew + exe "silent! 27" . XdoCmd + exe "silent! 4,5" . XdoCmd + call assert_equal([], l) + + " Run commands from an unsaved buffer + let v:errmsg='' + let l = [] + enew + setlocal modified + exe "silent! 2,2" . XdoCmd + if v:errmsg !~# 'No write since last change' + call add(v:errors, 'Unsaved file change test failed') + endif + + " If the executed command fails, then the operation should be aborted + enew! + let subst_count = 0 + exe "silent!" . Xdo . " s/Line/xLine/ | let subst_count += 1" + if subst_count != 1 || getline('.') != 'xLine1' + call add(v:errors, 'Abort command on error test failed') + endif + + let l = [] + exe "2,2" . Xdo . "! call add(l, GetRuler())" + call assert_equal(['Xtestfile2 2L 2C'], l) + + " List with no valid error entries + let l = [] + edit! +2 Xtestfile1 + exe Xgetexpr . " ['non-error 1', 'non-error 2', 'non-error 3']" + exe XdoCmd + call assert_equal([], l) + exe "silent! 2" . XdoCmd + call assert_equal([], l) + let v:errmsg='' + exe "%" . XdoCmd + exe "1,$" . XdoCmd + exe "." . XdoCmd + call assert_equal('', v:errmsg) + + " List with only one valid entry + let l = [] + exe Xgetexpr . " ['Xtestfile3:3:1:Line3']" + exe XdoCmd + call assert_equal(['Xtestfile3 3L 1C'], l) + +endfunction + +" Tests for the :cfdo and :lfdo commands +function XfdoTests(cchar) + enew + + " Shortcuts for calling the cfdo and lfdo commands + let Xfdo = a:cchar . 'fdo' + let Xgetexpr = a:cchar . 'getexpr' + let XfdoCmd = Xfdo . ' call add(l, GetRuler())' + let Xpfile = a:cchar. 'pfile' + + " Clear the quickfix/location list + exe Xgetexpr . " []" + + " Try with an empty list + let l = [] + exe XfdoCmd + call assert_equal([], l) + + " Populate the list and then try + exe Xgetexpr . " ['non-error 1', 'Xtestfile1:1:3:Line1', 'Xtestfile1:2:1:Line2', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:2:3:Line2', 'Xtestfile3:3:1:Line3']" + + let l = [] + exe XfdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l) + + " Run command only on selected error lines + let l = [] + exe "2,3" . XfdoCmd + call assert_equal(['Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l) + + " Boundary condition tests + let l = [] + exe "3" . XfdoCmd + call assert_equal(['Xtestfile3 2L 3C'], l) + + " Range test commands + let l = [] + exe "%" . XfdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l) + + let l = [] + exe "1,$" . XfdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l) + + let l = [] + exe Xpfile + exe "." . XfdoCmd + call assert_equal(['Xtestfile2 2L 2C'], l) + + " List with only one valid entry + let l = [] + exe Xgetexpr . " ['Xtestfile2:2:5:Line2']" + exe XfdoCmd + call assert_equal(['Xtestfile2 2L 5C'], l) + +endfunction + +" Tests for cdo and cfdo +function Test_cdo() + call XdoTests('c') + call XfdoTests('c') +endfunction + +" Tests for ldo and lfdo +function Test_ldo() + call XdoTests('l') + call XfdoTests('l') +endfunction diff --git a/src/version.c b/src/version.c index f949e64273..262876e2bc 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 980, /**/ 979, /**/ From 4686b323e4bc0f466500b018959f6c8965f010f9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 28 Dec 2015 14:44:10 +0100 Subject: [PATCH 02/10] patch 7.4.981 Problem: An error in a test script goes unnoticed. Solution: Source the test script inside try/catch. (Hirohito Higashi) --- src/testdir/runtest.vim | 17 ++++++++++------- src/version.c | 2 ++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index 0dc142eb97..cca7c751df 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -21,9 +21,7 @@ " It will be called after each Test_ function. " Without the +eval feature we can't run these tests, bail out. -if 0 - quit! -endif +so small.vim " Check that the screen size is at least 24 x 80 characters. if &lines < 24 || &columns < 80 @@ -38,7 +36,15 @@ endif " Source the test script. First grab the file name, in case the script " navigates away. let testname = expand('%') -source % +let done = 0 +let fail = 0 +let errors = [] +try + source % +catch + let fail += 1 + call add(errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint) +endtry " Locate Test_ functions and execute them. redir @q @@ -46,9 +52,6 @@ function /^Test_ redir END let tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g')) -let done = 0 -let fail = 0 -let errors = [] for test in tests if exists("*SetUp") call SetUp() diff --git a/src/version.c b/src/version.c index 262876e2bc..ac5bb1f225 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 981, /**/ 980, /**/ From 7b6156f4cd4027b664a916ba546e9b05d4c49e11 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 28 Dec 2015 16:01:26 +0100 Subject: [PATCH 03/10] patch 7.4.982 Problem: Keeping the list of tests updated is a hassle. Solution: Move the list to a separate file, so that it only needs to be udpated in one place. --- src/testdir/Make_all.mak | 181 ++++++++++++++++++++++++++++++++++ src/testdir/Make_amiga.mak | 192 +------------------------------------ src/testdir/Make_dos.mak | 70 ++------------ src/testdir/Make_ming.mak | 76 ++------------- src/testdir/Make_os2.mak | 59 ++---------- src/testdir/Make_vms.mms | 59 +----------- src/testdir/Makefile | 70 ++------------ src/version.c | 2 + 8 files changed, 223 insertions(+), 486 deletions(-) create mode 100644 src/testdir/Make_all.mak diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak new file mode 100644 index 0000000000..1318cfd75c --- /dev/null +++ b/src/testdir/Make_all.mak @@ -0,0 +1,181 @@ +# +# Common Makefile, defines the list of tests to run. +# + +# Tests that run on all systems. +SCRIPTS_ALL = \ + test1.out \ + test3.out \ + test4.out \ + test5.out \ + test6.out \ + test7.out \ + test8.out \ + test9.out \ + test13.out \ + test14.out \ + test15.out \ + test18.out \ + test19.out \ + test20.out \ + test21.out \ + test22.out \ + test23.out \ + test24.out \ + test26.out \ + test28.out \ + test29.out \ + test31.out \ + test33.out \ + test34.out \ + test35.out \ + test36.out \ + test37.out \ + test38.out \ + test39.out \ + test40.out \ + test41.out \ + test42.out \ + test43.out \ + test44.out \ + test45.out \ + test46.out \ + test47.out \ + test48.out \ + test51.out \ + test53.out \ + test55.out \ + test56.out \ + test57.out \ + test60.out \ + test61.out \ + test62.out \ + test63.out \ + test64.out \ + test65.out \ + test66.out \ + test67.out \ + test68.out \ + test69.out \ + test70.out \ + test71.out \ + test73.out \ + test74.out \ + test75.out \ + test76.out \ + test77.out \ + test79.out \ + test80.out \ + test81.out \ + test82.out \ + test84.out \ + test88.out \ + test90.out \ + test91.out \ + test92.out \ + test93.out \ + test94.out \ + test95.out \ + test96.out \ + test98.out \ + test99.out \ + test101.out \ + test102.out \ + test103.out \ + test104.out \ + test105.out \ + test106.out \ + test107.out \ + test_argument_0count.out \ + test_argument_count.out \ + test_autocmd_option.out \ + test_autoformat_join.out \ + test_breakindent.out \ + test_changelist.out \ + test_charsearch.out \ + test_close_count.out \ + test_command_count.out \ + test_comparators.out \ + test_erasebackword.out \ + test_eval.out \ + test_fixeol.out \ + test_increment.out \ + test_insertcount.out \ + test_listchars.out \ + test_listlbr.out \ + test_listlbr_utf8.out \ + test_mapping.out \ + test_marks.out \ + test_match_conceal.out \ + test_nested_function.out \ + test_options.out \ + test_perl.out \ + test_qf_title.out \ + test_ruby.out \ + test_search_mbyte.out \ + test_set.out \ + test_signs.out \ + test_tagcase.out \ + test_textobjects.out \ + test_utf8.out \ + test_writefile.out + + +# Tests that run on most systems, but not on Amiga. +SCRIPTS_MORE1 = \ + test11.out \ + test49.out \ + test52.out \ + test85.out \ + test86.out \ + test87.out + + +# Tests that run on most systems, but not on Amiga and DOS/Windows. +SCRIPTS_MORE2 = \ + test2.out \ + test10.out \ + test12.out \ + test25.out \ + test27.out \ + test97.out + + +# Tests that run on most systems, but not MingW and Cygwin. +SCRIPTS_MORE3 = \ + test54.out + + +# Tests that run on most systems, but not on VMS +SCRIPTS_MORE4 = \ + test17.out \ + test30.out \ + test32.out \ + test58.out \ + test59.out \ + test72.out \ + test78.out \ + test83.out \ + test89.out + + +# Tests specifically for MS-Windows. +SCRIPTS_WIN32 = test50.out test70.out + + +# Tests for the GUI. +SCRIPTS_GUI = test16.out + + +# Tests using runtest.vim.vim. +# Keep test_alot.res as the last one, sort the others. +NEW_TESTS = test_assert.res \ + test_cdo.res \ + test_alot.res + + +# Explicit dependencies. +test49.out: test49.vim + +test60.out: test60.vim + diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index 250209b597..8948382a6a 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -5,6 +5,8 @@ VIMPROG = /vim +include Make_all.mak + # These tests don't work (yet): # test2 "\\tmp" doesn't work # test10 'errorformat' is different @@ -16,59 +18,7 @@ VIMPROG = /vim # test85 no Lua interface # test86, 87 no Python interface -SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ - test7.out test8.out test9.out \ - test13.out test14.out test15.out test17.out \ - test18.out test19.out test20.out test21.out test22.out \ - test23.out test24.out test26.out \ - test28.out test29.out test30.out test31.out test32.out \ - test33.out test34.out test35.out test36.out test37.out \ - test38.out test39.out test40.out test41.out test42.out \ - test43.out test44.out test45.out test46.out test47.out \ - test48.out test51.out test53.out test54.out test55.out \ - test56.out test57.out test58.out test59.out test60.out \ - test61.out test62.out test63.out test64.out test65.out \ - test66.out test67.out test68.out test69.out test70.out \ - test71.out test72.out test73.out test74.out test75.out \ - test76.out test77.out test78.out test79.out test80.out \ - test81.out test82.out test83.out test84.out test88.out \ - test89.out test90.out test91.out test92.out test93.out \ - test94.out test95.out test96.out test97.out test98.out \ - test99.out test101.out test102.out test103.out \ - test104.out test105.out test106.out test107.out \ - test_argument_0count.out \ - test_argument_count.out \ - test_autocmd_option.out \ - test_autoformat_join.out \ - test_breakindent.out \ - test_changelist.out \ - test_charsearch.out \ - test_close_count.out \ - test_command_count.out \ - test_comparators.out \ - test_erasebackword.out \ - test_eval.out \ - test_fixeol.out \ - test_increment.out \ - test_insertcount.out \ - test_listchars.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_mapping.out \ - test_marks.out \ - test_match_conceal.out \ - test_nested_function.out \ - test_options.out \ - test_perl.out \ - test_qf_title.out \ - test_ruby.out \ - test_search_mbyte.out \ - test_set.out \ - test_signs.out \ - test_tagcase.out \ - test_textobjects.out \ - test_utf8.out \ - test_writefile.out +SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE3) $(SCRIPTS_MORE4) .SUFFIXES: .in .out @@ -90,137 +40,5 @@ clean: /tmp: makedir /tmp -# Manx requires all dependencies... -test1.out: test1.in -test2.out: test2.in -test3.out: test3.in -test4.out: test4.in -test5.out: test5.in -test6.out: test6.in -test7.out: test7.in -test8.out: test8.in -test9.out: test9.in -test10.out: test10.in -test11.out: test11.in -test12.out: test12.in -test13.out: test13.in -test14.out: test14.in -test15.out: test15.in -test16.out: test16.in -test17.out: test17.in -test18.out: test18.in -test19.out: test19.in -test20.out: test20.in -test21.out: test21.in -test22.out: test22.in -test23.out: test23.in -test24.out: test24.in -test25.out: test25.in -test26.out: test26.in -test27.out: test27.in -test28.out: test28.in -test29.out: test29.in -test30.out: test30.in -test31.out: test31.in -test32.out: test32.in -test33.out: test33.in -test34.out: test34.in -test35.out: test35.in -test36.out: test36.in -test37.out: test37.in -test38.out: test38.in -test39.out: test39.in -test40.out: test40.in -test41.out: test41.in -test42.out: test42.in -test43.out: test43.in -test44.out: test44.in -test45.out: test45.in -test46.out: test46.in -test47.out: test47.in -test48.out: test48.in -test51.out: test51.in -test53.out: test53.in -test54.out: test54.in -test55.out: test55.in -test56.out: test56.in -test57.out: test57.in -test58.out: test58.in -test59.out: test59.in -test60.out: test60.in -test61.out: test61.in -test62.out: test62.in -test63.out: test63.in -test64.out: test64.in -test65.out: test65.in -test66.out: test66.in -test67.out: test67.in -test68.out: test68.in -test69.out: test69.in -test70.out: test70.in -test71.out: test71.in -test72.out: test72.in -test73.out: test73.in -test74.out: test74.in -test75.out: test75.in -test76.out: test76.in -test77.out: test77.in -test78.out: test78.in -test79.out: test79.in -test80.out: test80.in -test81.out: test81.in -test82.out: test82.in -test83.out: test83.in -test84.out: test84.in -test88.out: test88.in -test89.out: test89.in -test90.out: test90.in -test91.out: test91.in -test92.out: test92.in -test93.out: test93.in -test94.out: test94.in -test95.out: test95.in -test96.out: test96.in -test97.out: test97.in -test98.out: test98.in -test99.out: test99.in -test101.out: test101.in -test102.out: test102.in -test103.out: test103.in -test104.out: test104.in -test105.out: test105.in -test106.out: test106.in -test107.out: test107.in -test_argument_0count.out: test_argument_0count.in -test_argument_count.out: test_argument_count.in -test_autocmd_option.out: test_autocmd_option.in -test_autoformat_join.out: test_autoformat_join.in -test_breakindent.out: test_breakindent.in -test_changelist.out: test_changelist.in -test_charsearch.out: test_charsearch.in -test_close_count.out: test_close_count.in -test_command_count.out: test_command_count.in -test_comparators.out: test_comparators.in -test_erasebackword.out: test_erasebackword.in -test_eval.out: test_eval.in -test_increment.out: test_increment.in -test_fixeol.out: test_fixeol.in -test_insertcount.out: test_insertcount.in -test_listchars.out: test_listchars.in -test_listlbr.out: test_listlbr.in -test_listlbr_utf8.out: test_listlbr_utf8.in -test_mapping.out: test_mapping.in -test_marks.out: test_marks.in -test_match_conceal.out: test_match_conceal.in -test_nested_function.out: test_nested_function.in -test_options.out: test_options.in -test_perl.out: test_perl.in -test_qf_title.out: test_qf_title.in -test_ruby.out: test_ruby.in -test_search_mbyte.out: test_search_mbyte.in -test_set.out: test_set.in -test_signs.out: test_signs.in -test_tagcase.out: test_tagcase.in -test_textobjects.out: test_textobjects.in -test_utf8.out: test_utf8.in -test_writefile.out: test_writefile.in +# Manx requires all dependencies, but we stopped updating them. +# Delete the .out file(s) to run test(s). diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 5b16874a13..12ff9ba3ed 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -5,6 +5,8 @@ VIMPROG = ..\\vim +!include Make_all.mak + # Omitted: # test2 "\\tmp" doesn't work. # test10 'errorformat' is different @@ -13,80 +15,22 @@ VIMPROG = ..\\vim # test27 can't edit file with "*" in file name # test97 \{ and \$ are not escaped characters. -SCRIPTS16 = test1.out test19.out test20.out test22.out \ - test23.out test24.out test28.out test29.out \ - test35.out test36.out test43.out \ - test44.out test45.out test46.out test47.out \ - test48.out test51.out test53.out test54.out \ - test55.out test56.out test57.out test58.out test59.out \ - test60.out test61.out test62.out test63.out test64.out +SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE3) $(SCRIPTS_MORE4) -SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ - test8.out test9.out test11.out test13.out test14.out \ - test15.out test17.out test18.out test21.out test26.out \ - test30.out test31.out test32.out test33.out test34.out \ - test37.out test38.out test39.out test40.out test41.out \ - test42.out test52.out test65.out test66.out test67.out \ - test68.out test69.out test71.out test72.out test73.out \ - test74.out test75.out test76.out test77.out test78.out \ - test79.out test80.out test81.out test82.out test83.out \ - test84.out test85.out test86.out test87.out test88.out \ - test89.out test90.out test91.out test92.out test93.out \ - test94.out test95.out test96.out test98.out test99.out \ - test101.out test102.out test103.out test104.out \ - test105.out test106.out test107.out\ - test_argument_0count.out \ - test_argument_count.out \ - test_autocmd_option.out \ - test_autoformat_join.out \ - test_breakindent.out \ - test_changelist.out \ - test_charsearch.out \ - test_close_count.out \ - test_command_count.out \ - test_comparators.out \ - test_erasebackword.out \ - test_eval.out \ - test_fixeol.out \ - test_increment.out \ - test_insertcount.out \ - test_listchars.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_mapping.out \ - test_marks.out \ - test_match_conceal.out \ - test_nested_function.out \ - test_options.out \ - test_perl.out \ - test_qf_title.out \ - test_ruby.out \ - test_search_mbyte.out \ - test_set.out \ - test_signs.out \ - test_tagcase.out \ - test_textobjects.out \ - test_utf8.out \ - test_writefile.out - -SCRIPTS32 = test50.out test70.out - -SCRIPTS_GUI = test16.out - -TEST_OUTFILES = $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) $(SCRIPTS_GUI) +TEST_OUTFILES = $(SCRIPTS) $(SCRIPTS_WIN32) $(SCRIPTS_GUI) DOSTMP = dostmp DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test) DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in) .SUFFIXES: .in .out -nongui: nolog $(SCRIPTS16) $(SCRIPTS) report +nongui: nolog $(SCRIPTS) report small: nolog report -gui: nolog $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) report +gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report -win32: nolog $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) report +win32: nolog $(SCRIPTS) $(SCRIPTS_WIN32) report # Copy the input files to dostmp, changing the fileformat to dos. $(DOSTMP_INFILES): $(*B).in diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index fc9bd93d72..393c60d9e3 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -24,85 +24,27 @@ endif VIMPROG = ..$(DIRSLASH)vim +include Make_all.mak + # Omitted: # test2 "\\tmp" doesn't work. # test10 'errorformat' is different # test12 can't unlink a swap file # test25 uses symbolic link # test27 can't edit file with "*" in file name -# test97 \{ and \$ are not escaped characters. +# test54 doesn't work yet +# test97 \{ and \$ are not escaped characters -SCRIPTS16 = test1.out test19.out test20.out test22.out \ - test23.out test24.out test28.out test29.out \ - test35.out test36.out test43.out \ - test44.out test45.out test46.out test47.out \ - test48.out test51.out test53.out \ - test55.out test56.out test57.out test58.out test59.out \ - test60.out test61.out test62.out test63.out test64.out - -# Had to remove test54 which doesn't work yet. -# test54.out - -SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ - test8.out test9.out test11.out test13.out test14.out \ - test15.out test17.out test18.out test21.out test26.out \ - test30.out test31.out test32.out test33.out test34.out \ - test37.out test38.out test39.out test40.out test41.out \ - test42.out test52.out test65.out test66.out test67.out \ - test68.out test69.out test71.out test72.out test73.out \ - test74.out test75.out test76.out test77.out test78.out \ - test79.out test80.out test81.out test82.out test83.out \ - test84.out test85.out test86.out test87.out test88.out \ - test89.out test90.out test91.out test92.out test93.out \ - test94.out test95.out test96.out test98.out test99.out \ - test101.out test102.out test103.out test104.out \ - test105.out test106.out test107.out \ - test_argument_0count.out \ - test_argument_count.out \ - test_autocmd_option.out \ - test_autoformat_join.out \ - test_breakindent.out \ - test_changelist.out \ - test_charsearch.out \ - test_close_count.out \ - test_command_count.out \ - test_comparators.out \ - test_erasebackword.out \ - test_eval.out \ - test_fixeol.out \ - test_increment.out \ - test_insertcount.out \ - test_listchars.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_mapping.out \ - test_marks.out \ - test_match_conceal.out \ - test_nested_function.out \ - test_options.out \ - test_perl.out \ - test_qf_title.out \ - test_ruby.out \ - test_search_mbyte.out \ - test_set.out \ - test_signs.out \ - test_tagcase.out \ - test_textobjects.out \ - test_utf8.out \ - test_writefile.out - -SCRIPTS32 = test50.out test70.out - -SCRIPTS_GUI = test16.out +SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) $(SCRIPTS_WIN32) SCRIPTS_BENCH = bench_re_freeze.out .SUFFIXES: .in .out -vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32) +vimall: fixff $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) echo ALL DONE -nongui: fixff $(SCRIPTS16) $(SCRIPTS) +nongui: fixff $(SCRIPTS) echo ALL DONE benchmark: $(SCRIPTS_BENCH) @@ -110,10 +52,10 @@ benchmark: $(SCRIPTS_BENCH) small: echo ALL DONE -gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) +gui: fixff $(SCRIPTS) $(SCRIPTS_GUI) echo ALL DONE -win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) +win32: fixff $(SCRIPTS) $(SCRIPTS_WIN32) echo ALL DONE fixff: diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index 8ba54f2182..12fe8c0a17 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -1,10 +1,15 @@ # # Makefile to run all tests for Vim, on OS/2 # +# OUTDATED, probably doesn't work. +# # Requires a set of Unix tools: echo, diff, etc. +# VIMPROG = ../vim.exe +include Make_all.mak + # Omitted: # test2 "\\tmp" doesn't work. # test10 'errorformat' is different @@ -17,59 +22,7 @@ VIMPROG = ../vim.exe # test86, 87 no Python interface # test97 \{ and \$ are not escaped characters. -SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ - test7.out test8.out test9.out \ - test13.out test14.out test15.out test17.out \ - test18.out test19.out test20.out test21.out test22.out \ - test23.out test24.out test26.out \ - test28.out test29.out test30.out test31.out test32.out \ - test33.out test34.out test35.out test36.out test37.out \ - test38.out test39.out test40.out test41.out test42.out \ - test43.out test44.out test45.out test46.out test47.out \ - test48.out test51.out test53.out test54.out test55.out \ - test56.out test57.out test58.out test59.out test60.out \ - test61.out test62.out test63.out test64.out test65.out \ - test66.out test67.out test68.out test69.out test70.out \ - test71.out test72.out test73.out test74.out test75.out \ - test76.out test77.out test78.out test79.out test80.out \ - test81.out test82.out test83.out test84.out test88.out \ - test89.out test90.out test91.out test92.out test93.out \ - test94.out test95.out test96.out test98.out test99.out \ - test101.out test102.out test103.out test104.out \ - test105.out test106.out test107.out \ - test_argument_0count.out \ - test_argument_count.out \ - test_autocmd_option.out \ - test_autoformat_join.out \ - test_breakindent.out \ - test_changelist.out \ - test_charsearch.out \ - test_close_count.out \ - test_command_count.out \ - test_comparators.out \ - test_erasebackword.out \ - test_eval.out \ - test_fixeol.out \ - test_increment.out \ - test_insertcount.out \ - test_listchars.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_mapping.out \ - test_marks.out \ - test_match_conceal.out \ - test_nested_function.out \ - test_options.out \ - test_perl.out \ - test_qf_title.out \ - test_ruby.out \ - test_search_mbyte.out \ - test_set.out \ - test_signs.out \ - test_tagcase.out \ - test_textobjects.out \ - test_utf8.out \ - test_writefile.out +SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE3) $(SCRIPTS_MORE4) SCRIPTS_BENCH = bench_re_freeze.out diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 70ba14876d..8bcf257459 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -4,7 +4,7 @@ # Authors: Zoltan Arpadffy, # Sandor Kopanyi, # -# Last change: 2015 Dec 03 +# Last change: 2015 Dec 28 # # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64. # Edit the lines in the Configuration section below to select. @@ -74,61 +74,12 @@ VIMPROG = <->vim.exe +# This probably doesn't work, please fix. +.INCLUDE Make_all.mak + .SUFFIXES : .out .in -SCRIPT = test1.out test2.out test3.out test4.out test5.out \ - test6.out test7.out test8.out test9.out test10a.out\ - test13.out test14.out test15.out \ - test18.out test19.out test20.out test21.out test22.out \ - test23.out test24.out test26.out \ - test28.out test29.out test30.out test31.out test32.out \ - test33.out test34.out test35.out test36.out test37.out \ - test38.out test39.out test40.out test41.out test42.out \ - test43.out test44.out test45.out test46.out \ - test48.out test49.out test51.out test53.out test54.out \ - test55.out test56.out test57.out test60.out \ - test61.out test62.out test63.out test64.out test65.out \ - test66.out test67.out test68.out test69.out \ - test71.out test72.out test74.out test75.out test76.out \ - test77a.out test78.out test79.out test80.out test81.out \ - test82.out test84.out test88.out test89.out \ - test90.out test91.out test92.out test93.out test94.out \ - test95.out test96.out test98.out test99.out \ - test101.out test103.out test104.out \ - test105.out test106.out test107.out \ - test_argument_0count.out \ - test_argument_count.out \ - test_autocmd_option.out \ - test_autoformat_join.out \ - test_breakindent.out \ - test_changelist.out \ - test_charsearch.out \ - test_close_count.out \ - test_command_count.out \ - test_comparators.out \ - test_erasebackword.out \ - test_eval.out \ - test_fixeol.out \ - test_increment.out \ - test_insertcount.out \ - test_listchars.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_mapping.out \ - test_marks.out \ - test_match_conceal.out \ - test_nested_function.out \ - test_options.out \ - test_perl.out \ - test_qf_title.out \ - test_ruby.out \ - test_search_mbyte.out \ - test_set.out \ - test_signs.out \ - test_tagcase.out \ - test_textobjects.out \ - test_utf8.out \ - test_writefile.out +SCRIPT = $(SCRIPTS_ALL) $(SCRIPTS_MORE3) # Known problems: # test17: ? diff --git a/src/testdir/Makefile b/src/testdir/Makefile index cb0ec4596b..c8ff87b3cf 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -15,66 +15,16 @@ SCRIPTSOURCE = ../../runtime # VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --log-file=valgrind.$* -SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ - test7.out test8.out test9.out test10.out test11.out \ - test12.out test13.out test14.out test15.out test17.out \ - test18.out test19.out test20.out test21.out test22.out \ - test23.out test24.out test25.out test26.out test27.out \ - test28.out test29.out test30.out test31.out test32.out \ - test33.out test34.out test35.out test36.out test37.out \ - test38.out test39.out test40.out test41.out test42.out \ - test43.out test44.out test45.out test46.out test47.out \ - test48.out test49.out test51.out test52.out test53.out \ - test54.out test55.out test56.out test57.out test58.out \ - test59.out test60.out test61.out test62.out test63.out \ - test64.out test65.out test66.out test67.out test68.out \ - test69.out test70.out test71.out test72.out test73.out \ - test74.out test75.out test76.out test77.out test78.out \ - test79.out test80.out test81.out test82.out test83.out \ - test84.out test85.out test86.out test87.out test88.out \ - test89.out test90.out test91.out test92.out test93.out \ - test94.out test95.out test96.out test97.out test98.out \ - test99.out test101.out test102.out test103.out \ - test104.out test105.out test106.out test107.out \ - test_argument_0count.out \ - test_argument_count.out \ - test_autocmd_option.out \ - test_autoformat_join.out \ - test_breakindent.out \ - test_changelist.out \ - test_charsearch.out \ - test_close_count.out \ - test_command_count.out \ - test_comparators.out \ - test_erasebackword.out \ - test_eval.out \ - test_fixeol.out \ - test_increment.out \ - test_insertcount.out \ - test_listchars.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_mapping.out \ - test_marks.out \ - test_match_conceal.out \ - test_nested_function.out \ - test_options.out \ - test_perl.out \ - test_qf_title.out \ - test_ruby.out \ - test_search_mbyte.out \ - test_set.out \ - test_signs.out \ - test_tagcase.out \ - test_textobjects.out \ - test_utf8.out \ - test_writefile.out +# The list of tests is common to all systems. +# This defines NEW_TESTS, SCRIPTS_ALL, SCRIPTS_MORE* and SCRIPTS_GUI. +include Make_all.mak -NEW_TESTS = test_assert.res \ - test_cdo.res \ - test_alot.res -SCRIPTS_GUI = test16.out +SCRIPTS = $(SCRIPTS_ALL) \ + $(SCRIPTS_MORE1) \ + $(SCRIPTS_MORE2) \ + $(SCRIPTS_MORE3) \ + $(SCRIPTS_MORE4) SCRIPTS_BENCH = bench_re_freeze.out @@ -148,10 +98,6 @@ test1.out: test1.in fi" -rm -rf X* test.ok viminfo -test49.out: test49.vim - -test60.out: test60.vim - bench_re_freeze.out: bench_re_freeze.vim -rm -rf benchmark.out $(RM_ON_RUN) # Sleep a moment to avoid that the xterm title is messed up. diff --git a/src/version.c b/src/version.c index ac5bb1f225..60a9b547a4 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 982, /**/ 981, /**/ From a60824308cd9bc192c5d38fc16cccfcf652b40f6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 28 Dec 2015 16:26:45 +0100 Subject: [PATCH 04/10] patch 7.4.983 Problem: Executing one test after "make testclean" doesn't work. Solution: Add a dependency on test1.out. --- src/testdir/Make_all.mak | 5 ++++- src/testdir/Make_amiga.mak | 5 ++++- src/testdir/Make_dos.mak | 11 +++++++---- src/testdir/Make_ming.mak | 11 +++++++---- src/testdir/Make_os2.mak | 7 +++++-- src/testdir/Make_vms.mms | 2 +- src/testdir/Makefile | 9 ++++++--- src/version.c | 2 ++ 8 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 1318cfd75c..c88ed1c2f7 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -2,9 +2,12 @@ # Common Makefile, defines the list of tests to run. # +# The first script creates small.vim. +SCRIPTS_FIRST = \ + test1.out + # Tests that run on all systems. SCRIPTS_ALL = \ - test1.out \ test3.out \ test4.out \ test5.out \ diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index 8948382a6a..edb390d1f1 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -20,9 +20,12 @@ include Make_all.mak SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE3) $(SCRIPTS_MORE4) +# Must run test1 first to create small.vim. +$(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS): $(SCRIPTS_FIRST) + .SUFFIXES: .in .out -nongui: /tmp $(SCRIPTS) +nongui: /tmp $(SCRIPTS_FIRST) $(SCRIPTS) csh -c echo ALL DONE clean: diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 12ff9ba3ed..6e92668c8b 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -17,20 +17,23 @@ VIMPROG = ..\\vim SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE3) $(SCRIPTS_MORE4) -TEST_OUTFILES = $(SCRIPTS) $(SCRIPTS_WIN32) $(SCRIPTS_GUI) +TEST_OUTFILES = $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) $(SCRIPTS_GUI) DOSTMP = dostmp DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test) DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in) .SUFFIXES: .in .out -nongui: nolog $(SCRIPTS) report +# Must run test1 first to create small.vim. +$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS): $(SCRIPTS_FIRST) + +nongui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) report small: nolog report -gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report +gui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) report -win32: nolog $(SCRIPTS) $(SCRIPTS_WIN32) report +win32: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) report # Copy the input files to dostmp, changing the fileformat to dos. $(DOSTMP_INFILES): $(*B).in diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 393c60d9e3..2237f570b4 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -39,12 +39,15 @@ SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) $(SCRIPTS_WIN32) SCRIPTS_BENCH = bench_re_freeze.out +# Must run test1 first to create small.vim. +$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS): $(SCRIPTS_FIRST) + .SUFFIXES: .in .out -vimall: fixff $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) +vimall: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) echo ALL DONE -nongui: fixff $(SCRIPTS) +nongui: fixff $(SCRIPTS_FIRST) $(SCRIPTS) echo ALL DONE benchmark: $(SCRIPTS_BENCH) @@ -52,10 +55,10 @@ benchmark: $(SCRIPTS_BENCH) small: echo ALL DONE -gui: fixff $(SCRIPTS) $(SCRIPTS_GUI) +gui: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) echo ALL DONE -win32: fixff $(SCRIPTS) $(SCRIPTS_WIN32) +win32: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) echo ALL DONE fixff: diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index 12fe8c0a17..fd25ab87e9 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -28,10 +28,13 @@ SCRIPTS_BENCH = bench_re_freeze.out .SUFFIXES: .in .out -all: /tmp $(SCRIPTS) +all: /tmp $(SCRIPTS_FIRST) $(SCRIPTS) @echo ALL DONE -$(SCRIPTS): $(VIMPROG) +$(SCRIPTS_FIRST) $(SCRIPTS): $(VIMPROG) + +# Must run test1 first to create small.vim. +$(SCRIPTS): $(SCRIPTS_FIRST) benchmark: $(SCRIPTS_BENCH) diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 8bcf257459..415a13fa50 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -170,7 +170,7 @@ SCRIPT_PYTHON = test86.out test87.out -@ if "''F$SEARCH("Xdotest.*")'" .NES. "" then delete/noconfirm/nolog Xdotest.*.* -@ if "''F$SEARCH("Xtest.*")'" .NES. "" then delete/noconfirm/nolog Xtest.*.* -all : clean nolog $(START_WITH) $(SCRIPT) $(SCRIPT_GUI) $(SCRIPT_UNIX) $(SCRIPT_WIN) $(SCRIPT_SPELL) $(SCRIPT_ODS5) $(SCRIPT_GZIP) \ +all : clean nolog $(SCRIPTS_FIRST) $(SCRIPT) $(SCRIPT_GUI) $(SCRIPT_UNIX) $(SCRIPT_WIN) $(SCRIPT_SPELL) $(SCRIPT_ODS5) $(SCRIPT_GZIP) \ $(SCRIPT_GDIFF) $(SCRIPT_MZSCH) $(SCRIPT_CKSUM) $(SCRIPT_ICONV) $(SCRIPT_LUA) $(SCRIPT_PYTHON) nolog -@ write sys$output " " -@ write sys$output "-----------------------------------------------" diff --git a/src/testdir/Makefile b/src/testdir/Makefile index c8ff87b3cf..ade975271c 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -30,9 +30,9 @@ SCRIPTS_BENCH = bench_re_freeze.out .SUFFIXES: .in .out .res .vim -nongui: nolog $(SCRIPTS) newtests report +nongui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests report -gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) newtests report +gui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests report benchmark: $(SCRIPTS_BENCH) @@ -44,7 +44,10 @@ report: else echo ALL DONE; \ fi" -$(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS): $(VIMPROG) +$(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS): $(VIMPROG) + +# Must run test1 first to create small.vim. +$(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS): $(SCRIPTS_FIRST) RM_ON_RUN = test.out X* viminfo RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok benchmark.out diff --git a/src/version.c b/src/version.c index 60a9b547a4..67f8d77f09 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 983, /**/ 982, /**/ From ad4d8a192abf44b89371af87d70b971cd654b799 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 28 Dec 2015 19:20:36 +0100 Subject: [PATCH 05/10] patch 7.4.984 Problem: searchpos() always starts searching in the first column, which is not what some people expect. (Brett Stahlman) Solution: Add the 'z' flag: start at the specified column. --- runtime/doc/eval.txt | 21 ++++++++++++++------- src/eval.c | 6 +++++- src/search.c | 11 ++++++++--- src/testdir/test_alot.vim | 1 + src/testdir/test_searchpos.vim | 28 ++++++++++++++++++++++++++++ src/version.c | 2 ++ src/vim.h | 1 + 7 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 src/testdir/test_searchpos.vim diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index f59c7f4ebe..cb612caaaf 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2015 Dec 03 +*eval.txt* For Vim version 7.4. Last change: 2015 Dec 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5228,14 +5228,15 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* move. No error message is given. {flags} is a String, which can contain these character flags: - 'b' search backward instead of forward - 'c' accept a match at the cursor position + 'b' search Backward instead of forward + 'c' accept a match at the Cursor position 'e' move to the End of the match 'n' do Not move the cursor - 'p' return number of matching sub-pattern (see below) - 's' set the ' mark at the previous location of the cursor - 'w' wrap around the end of the file - 'W' don't wrap around the end of the file + 'p' return number of matching sub-Pattern (see below) + 's' Set the ' mark at the previous location of the cursor + 'w' Wrap around the end of the file + 'W' don't Wrap around the end of the file + 'z' start searching at the cursor column instead of zero If neither 'w' or 'W' is given, the 'wrapscan' option applies. If the 's' flag is supplied, the ' mark is set, only if the @@ -5243,6 +5244,12 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* flag. 'ignorecase', 'smartcase' and 'magic' are used. + + When the 'z' flag is not given seaching always starts in + column zero and then matches before the cursor are skipped. + When the 'c' flag is present in 'cpo' the next search starts + after the match. Without the 'c' flag the next search starts + one column further. When the {stopline} argument is given then the search stops after searching this line. This is useful to restrict the diff --git a/src/eval.c b/src/eval.c index 2668f3db5b..a2d2939ba2 100644 --- a/src/eval.c +++ b/src/eval.c @@ -16471,6 +16471,7 @@ f_reverse(argvars, rettv) #define SP_START 0x10 /* accept match at start position */ #define SP_SUBPAT 0x20 /* return nr of matching sub-pattern */ #define SP_END 0x40 /* leave cursor at end of match */ +#define SP_COLUMN 0x80 /* start at cursor column */ static int get_search_arg __ARGS((typval_T *varp, int *flagsp)); @@ -16512,6 +16513,7 @@ get_search_arg(varp, flagsp) case 'p': mask = SP_SUBPAT; break; case 'r': mask = SP_REPEAT; break; case 's': mask = SP_SETPCMARK; break; + case 'z': mask = SP_COLUMN; break; } if (mask == 0) { @@ -16530,7 +16532,7 @@ get_search_arg(varp, flagsp) } /* - * Shared by search() and searchpos() functions + * Shared by search() and searchpos() functions. */ static int search_cmn(argvars, match_pos, flagsp) @@ -16562,6 +16564,8 @@ search_cmn(argvars, match_pos, flagsp) options |= SEARCH_START; if (flags & SP_END) options |= SEARCH_END; + if (flags & SP_COLUMN) + options |= SEARCH_COL; /* Optional arguments: line number to stop searching and timeout. */ if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) diff --git a/src/search.c b/src/search.c index 74398e39e8..1145558a69 100644 --- a/src/search.c +++ b/src/search.c @@ -578,6 +578,7 @@ last_pat_prog(regmatch) * if (options & SEARCH_KEEP) keep previous search pattern * if (options & SEARCH_FOLD) match only once in a closed fold * if (options & SEARCH_PEEK) check for typed char, cancel search + * if (options & SEARCH_COL) start at pos->col instead of zero * * Return FAIL (zero) for failure, non-zero for success. * When FEAT_EVAL is defined, returns the index of the first matching @@ -599,6 +600,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) { int found; linenr_T lnum; /* no init to shut up Apollo cc */ + colnr_T col; regmmatch_T regmatch; char_u *ptr; colnr_T matchcol; @@ -711,12 +713,14 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) /* * Look for a match somewhere in line "lnum". */ + col = at_first_line && (options & SEARCH_COL) ? pos->col + : (colnr_T)0; nmatched = vim_regexec_multi(®match, win, buf, - lnum, (colnr_T)0, + lnum, col, #ifdef FEAT_RELTIME - tm + tm #else - NULL + NULL #endif ); /* Abort searching on an error (e.g., out of stack). */ @@ -1098,6 +1102,7 @@ set_vv_searchforward() /* * Return the number of the first subpat that matched. + * Return zero if none of them matched. */ static int first_submatch(rp) diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim index 21a524116b..f15a2dce2c 100644 --- a/src/testdir/test_alot.vim +++ b/src/testdir/test_alot.vim @@ -2,5 +2,6 @@ " This makes testing go faster, since Vim doesn't need to restart. source test_lispwords.vim +source test_searchpos.vim source test_sort.vim source test_undolevels.vim diff --git a/src/testdir/test_searchpos.vim b/src/testdir/test_searchpos.vim new file mode 100644 index 0000000000..4a1e024ce7 --- /dev/null +++ b/src/testdir/test_searchpos.vim @@ -0,0 +1,28 @@ +" Tests for searchpos() + +func Test_searchpos() + new one + 0put ='1a3' + 1put ='123xyz' + call cursor(1, 1) + call assert_equal([1, 1, 2], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')) + call cursor(1, 2) + call assert_equal([2, 1, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')) + set cpo-=c + call cursor(1, 2) + call assert_equal([1, 2, 2], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')) + call cursor(1, 3) + call assert_equal([1, 3, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')) + + " Now with \zs, first match is in column 0, "a" is matched. + call cursor(1. 3) + call assert_equal([2, 4, 2], searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcW')) + " With z flag start at cursor column, don't see the "a". + call cursor(1. 3) + call assert_equal([2, 4, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcWz')) + + set cpo+=c + " close the window + q! + +endfunc diff --git a/src/version.c b/src/version.c index 67f8d77f09..5a5a59c8a6 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 984, /**/ 983, /**/ diff --git a/src/vim.h b/src/vim.h index 729c45a54d..11b9119f2e 100644 --- a/src/vim.h +++ b/src/vim.h @@ -930,6 +930,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define SEARCH_MARK 0x200 /* set previous context mark */ #define SEARCH_KEEP 0x400 /* keep previous search pattern */ #define SEARCH_PEEK 0x800 /* peek for typed char, cancel search */ +#define SEARCH_COL 0x1000 /* start at specified column instead of zero */ /* Values for find_ident_under_cursor() */ #define FIND_IDENT 1 /* find identifier (word) */ From f2f6d297966ec0e357640b71a238e51afcaba6cc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 28 Dec 2015 20:57:10 +0100 Subject: [PATCH 06/10] patch 7.4.985 Problem: Can't build with Ruby 2.3.0. Solution: Use the new TypedData_XXX macro family instead of Data_XXX. Use TypedData. (Ken Takata) --- src/if_ruby.c | 106 ++++++++++++++++++++++++++++++++++++++++++++------ src/version.c | 2 + 2 files changed, 97 insertions(+), 11 deletions(-) diff --git a/src/if_ruby.c b/src/if_ruby.c index 5d3089d1aa..51a9f03024 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -103,7 +103,6 @@ #endif #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22 # define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub -# define rb_check_type rb_check_type_stub #endif #include @@ -122,6 +121,15 @@ # define __OPENTRANSPORTPROVIDERS__ #endif +/* + * The TypedData_XXX macro family can be used since Ruby 1.9.2, and + * the old Data_XXX macro family was deprecated on Ruby 2.2. + * Use TypedData_XXX if available. + */ +#ifdef TypedData_Wrap_Struct +# define USE_TYPEDDATA 1 +#endif + /* * Backward compatibility for Ruby 1.8 and earlier. * Ruby 1.9 does not provide STR2CSTR, instead StringValuePtr is provided. @@ -184,11 +192,20 @@ static void ruby_vim_init(void); */ # define rb_assoc_new dll_rb_assoc_new # define rb_cObject (*dll_rb_cObject) -# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 22 -# define rb_check_type dll_rb_check_type +# define rb_check_type dll_rb_check_type +# ifdef USE_TYPEDDATA +# define rb_check_typeddata dll_rb_check_typeddata # endif # define rb_class_path dll_rb_class_path -# define rb_data_object_alloc dll_rb_data_object_alloc +# ifdef USE_TYPEDDATA +# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23 +# define rb_data_typed_object_wrap dll_rb_data_typed_object_wrap +# else +# define rb_data_typed_object_alloc dll_rb_data_typed_object_alloc +# endif +# else +# define rb_data_object_alloc dll_rb_data_object_alloc +# endif # define rb_define_class_under dll_rb_define_class_under # define rb_define_const dll_rb_define_const # define rb_define_global_function dll_rb_define_global_function @@ -297,8 +314,19 @@ static VALUE *dll_rb_cObject; VALUE *dll_rb_cSymbol; VALUE *dll_rb_cTrueClass; static void (*dll_rb_check_type) (VALUE,int); +# ifdef USE_TYPEDDATA +static void *(*dll_rb_check_typeddata) (VALUE,const rb_data_type_t *); +# endif static VALUE (*dll_rb_class_path) (VALUE); +# ifdef USE_TYPEDDATA +# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23 +static VALUE (*dll_rb_data_typed_object_wrap) (VALUE, void*, const rb_data_type_t *); +# else +static VALUE (*dll_rb_data_typed_object_alloc) (VALUE, void*, const rb_data_type_t *); +# endif +# else static VALUE (*dll_rb_data_object_alloc) (VALUE, void*, RUBY_DATA_FUNC, RUBY_DATA_FUNC); +# endif static VALUE (*dll_rb_define_class_under) (VALUE, const char*, VALUE); static void (*dll_rb_define_const) (VALUE,const char*,VALUE); static void (*dll_rb_define_global_function) (const char*,VALUE(*)(),int); @@ -451,13 +479,6 @@ void rb_gc_writebarrier_unprotect_stub(VALUE obj) # endif # endif -# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22 -void rb_check_type_stub(VALUE v, int i) -{ - dll_rb_check_type(v, i); -} -# endif - static HINSTANCE hinstRuby = NULL; /* Instance of ruby.dll */ /* @@ -480,8 +501,19 @@ static struct {"rb_cSymbol", (RUBY_PROC*)&dll_rb_cSymbol}, {"rb_cTrueClass", (RUBY_PROC*)&dll_rb_cTrueClass}, {"rb_check_type", (RUBY_PROC*)&dll_rb_check_type}, +# ifdef USE_TYPEDDATA + {"rb_check_typeddata", (RUBY_PROC*)&dll_rb_check_typeddata}, +# endif {"rb_class_path", (RUBY_PROC*)&dll_rb_class_path}, +# ifdef USE_TYPEDDATA +# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23 + {"rb_data_typed_object_wrap", (RUBY_PROC*)&dll_rb_data_typed_object_wrap}, +# else + {"rb_data_typed_object_alloc", (RUBY_PROC*)&dll_rb_data_typed_object_alloc}, +# endif +# else {"rb_data_object_alloc", (RUBY_PROC*)&dll_rb_data_object_alloc}, +# endif {"rb_define_class_under", (RUBY_PROC*)&dll_rb_define_class_under}, {"rb_define_const", (RUBY_PROC*)&dll_rb_define_const}, {"rb_define_global_function", (RUBY_PROC*)&dll_rb_define_global_function}, @@ -1026,6 +1058,24 @@ static VALUE vim_evaluate(VALUE self UNUSED, VALUE str) #endif } +#ifdef USE_TYPEDDATA +static size_t buffer_dsize(const void *buf); + +static const rb_data_type_t buffer_type = { + "vim_buffer", + {0, 0, buffer_dsize, {0, 0}}, + 0, 0, +# ifdef RUBY_TYPED_FREE_IMMEDIATELY + 0, +# endif +}; + +static size_t buffer_dsize(const void *buf UNUSED) +{ + return sizeof(buf_T); +} +#endif + static VALUE buffer_new(buf_T *buf) { if (buf->b_ruby_ref) @@ -1034,7 +1084,11 @@ static VALUE buffer_new(buf_T *buf) } else { +#ifdef USE_TYPEDDATA + VALUE obj = TypedData_Wrap_Struct(cBuffer, &buffer_type, buf); +#else VALUE obj = Data_Wrap_Struct(cBuffer, 0, 0, buf); +#endif buf->b_ruby_ref = (void *) obj; rb_hash_aset(objtbl, rb_obj_id(obj), obj); return obj; @@ -1045,7 +1099,11 @@ static buf_T *get_buf(VALUE obj) { buf_T *buf; +#ifdef USE_TYPEDDATA + TypedData_Get_Struct(obj, buf_T, &buffer_type, buf); +#else Data_Get_Struct(obj, buf_T, buf); +#endif if (buf == NULL) rb_raise(eDeletedBufferError, "attempt to refer to deleted buffer"); return buf; @@ -1242,6 +1300,24 @@ static VALUE buffer_append(VALUE self, VALUE num, VALUE str) return str; } +#ifdef USE_TYPEDDATA +static size_t window_dsize(const void *buf); + +static const rb_data_type_t window_type = { + "vim_window", + {0, 0, window_dsize, {0, 0}}, + 0, 0, +# ifdef RUBY_TYPED_FREE_IMMEDIATELY + 0, +# endif +}; + +static size_t window_dsize(const void *win UNUSED) +{ + return sizeof(win_T); +} +#endif + static VALUE window_new(win_T *win) { if (win->w_ruby_ref) @@ -1250,7 +1326,11 @@ static VALUE window_new(win_T *win) } else { +#ifdef USE_TYPEDDATA + VALUE obj = TypedData_Wrap_Struct(cVimWindow, &window_type, win); +#else VALUE obj = Data_Wrap_Struct(cVimWindow, 0, 0, win); +#endif win->w_ruby_ref = (void *) obj; rb_hash_aset(objtbl, rb_obj_id(obj), obj); return obj; @@ -1261,7 +1341,11 @@ static win_T *get_win(VALUE obj) { win_T *win; +#ifdef USE_TYPEDDATA + TypedData_Get_Struct(obj, win_T, &window_type, win); +#else Data_Get_Struct(obj, win_T, win); +#endif if (win == NULL) rb_raise(eDeletedWindowError, "attempt to refer to deleted window"); return win; diff --git a/src/version.c b/src/version.c index 5a5a59c8a6..d46aeae6a6 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 985, /**/ 984, /**/ From da9888a3f0118ce1ce5acbdcf4720602c2de2a3b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 28 Dec 2015 21:35:14 +0100 Subject: [PATCH 07/10] patch 7.4.986 Problem: Test49 doesn't work on MS-Windows. test70 is listed twice. Solution: Move test49 to the group not used on Amiga and MS-Windows. Remove test70 from SCRIPTS_WIN32. --- src/testdir/Make_all.mak | 4 ++-- src/testdir/Make_dos.mak | 1 + src/version.c | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index c88ed1c2f7..d0e277df8d 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -127,7 +127,6 @@ SCRIPTS_ALL = \ # Tests that run on most systems, but not on Amiga. SCRIPTS_MORE1 = \ test11.out \ - test49.out \ test52.out \ test85.out \ test86.out \ @@ -141,6 +140,7 @@ SCRIPTS_MORE2 = \ test12.out \ test25.out \ test27.out \ + test49.out \ test97.out @@ -163,7 +163,7 @@ SCRIPTS_MORE4 = \ # Tests specifically for MS-Windows. -SCRIPTS_WIN32 = test50.out test70.out +SCRIPTS_WIN32 = test50.out # Tests for the GUI. diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 6e92668c8b..b907fe7051 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -13,6 +13,7 @@ VIMPROG = ..\\vim # test12 can't unlink a swap file # test25 uses symbolic link # test27 can't edit file with "*" in file name +# test49 fails in various ways # test97 \{ and \$ are not escaped characters. SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE3) $(SCRIPTS_MORE4) diff --git a/src/version.c b/src/version.c index d46aeae6a6..8412461771 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 986, /**/ 985, /**/ From 0d27f64f7188efef99062a3c5694027c12401670 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 28 Dec 2015 22:05:28 +0100 Subject: [PATCH 08/10] patch 7.4.987 Problem: Can't build with Ruby 1.9.2. Solution: Require Rub 2.0 for defining USE_TYPEDDATA. --- src/if_ruby.c | 12 +++++++++--- src/version.c | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/if_ruby.c b/src/if_ruby.c index 51a9f03024..fa03359f01 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -81,6 +81,11 @@ # define RUBY19_OR_LATER 1 #endif +#if (defined(RUBY_VERSION) && RUBY_VERSION >= 20) \ + || (defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20) +# define RUBY20_OR_LATER 1 +#endif + #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19 /* Ruby 1.9 defines a number of static functions which use rb_num2long and * rb_int2big */ @@ -122,11 +127,12 @@ #endif /* - * The TypedData_XXX macro family can be used since Ruby 1.9.2, and - * the old Data_XXX macro family was deprecated on Ruby 2.2. + * The TypedData_XXX macro family can be used since Ruby 1.9.2 but + * rb_data_type_t changed in 1.9.3, therefore require at least 2.0. + * The old Data_XXX macro family was deprecated on Ruby 2.2. * Use TypedData_XXX if available. */ -#ifdef TypedData_Wrap_Struct +#if defined(TypedData_Wrap_Struct) && defined(RUBY20_OR_LATER) # define USE_TYPEDDATA 1 #endif diff --git a/src/version.c b/src/version.c index 8412461771..c304f69e69 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 987, /**/ 986, /**/ From 40bbceee2213a6fa8fdc1d3f3920d61fb5370803 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 28 Dec 2015 22:24:41 +0100 Subject: [PATCH 09/10] patch 7.4.988 Problem: Default test target is test49.out. Solution: Add a build rule before including Make_all.mak. --- src/testdir/Make_amiga.mak | 2 ++ src/testdir/Make_dos.mak | 2 ++ src/testdir/Make_ming.mak | 2 ++ src/testdir/Make_os2.mak | 2 ++ src/testdir/Make_vms.mms | 2 ++ src/testdir/Makefile | 1 + src/version.c | 2 ++ 7 files changed, 13 insertions(+) diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index edb390d1f1..c39e450d5c 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -5,6 +5,8 @@ VIMPROG = /vim +default: nongui + include Make_all.mak # These tests don't work (yet): diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index b907fe7051..e1bf100c43 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -5,6 +5,8 @@ VIMPROG = ..\\vim +default: nongui + !include Make_all.mak # Omitted: diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 2237f570b4..fb6278349c 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -24,6 +24,8 @@ endif VIMPROG = ..$(DIRSLASH)vim +default: vimall + include Make_all.mak # Omitted: diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index fd25ab87e9..828d354b46 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -8,6 +8,8 @@ VIMPROG = ../vim.exe +default: all + include Make_all.mak # Omitted: diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 415a13fa50..9a93e21a75 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -74,6 +74,8 @@ VIMPROG = <->vim.exe +default : all + # This probably doesn't work, please fix. .INCLUDE Make_all.mak diff --git a/src/testdir/Makefile b/src/testdir/Makefile index ade975271c..b587f32e91 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -14,6 +14,7 @@ SCRIPTSOURCE = ../../runtime # This will make testing about 10 times as slow. # VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --log-file=valgrind.$* +default: nongui # The list of tests is common to all systems. # This defines NEW_TESTS, SCRIPTS_ALL, SCRIPTS_MORE* and SCRIPTS_GUI. diff --git a/src/version.c b/src/version.c index c304f69e69..fcc22cd846 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 988, /**/ 987, /**/ From 0107f5ba87ca9427500d0fc42ec80a1f3fca9fdb Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 28 Dec 2015 22:51:20 +0100 Subject: [PATCH 10/10] patch 7.4.989 Problem: Leaking memory when hash_add() fails. Coverity error 99126. Solution: When hash_add() fails free the memory. --- src/eval.c | 6 +++++- src/version.c | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/eval.c b/src/eval.c index a2d2939ba2..eca8224ebf 100644 --- a/src/eval.c +++ b/src/eval.c @@ -23095,7 +23095,11 @@ ex_function(eap) /* insert the new function in the function list */ STRCPY(fp->uf_name, name); - hash_add(&func_hashtab, UF2HIKEY(fp)); + if (hash_add(&func_hashtab, UF2HIKEY(fp)) == FAIL) + { + vim_free(fp); + goto erret; + } } fp->uf_args = newargs; fp->uf_lines = newlines; diff --git a/src/version.c b/src/version.c index fcc22cd846..ddf260bbfd 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 989, /**/ 988, /**/