From 8b173a1de51c0547ad821ad745deb052d732128b Mon Sep 17 00:00:00 2001 From: watiko Date: Mon, 11 Jan 2016 05:05:11 +0900 Subject: tests: Remove needless line continuation. --- src/nvim/testdir/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index b4292dbd4b..8edbe303f2 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -160,7 +160,7 @@ RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPR newtests: newtestssilent @/bin/sh -c "if test -f messages && grep -q 'FAILED' messages; then \ cat messages && cat test.log; \ - fi" \ + fi" newtestssilent: $(NEW_TESTS) -- cgit From 85d06fef16894a0489467325b177f36ea750d6cf Mon Sep 17 00:00:00 2001 From: watiko Date: Sun, 10 Jan 2016 23:38:31 +0900 Subject: vim-patch:7.4.978 Problem: test_cdo fails when using another language than English. Solution: Set the language to C. (Dominique Pelle) https://github.com/vim/vim/commit/c42b9c670ea621d4dac0f216e011a6db576c5136 --- src/nvim/testdir/test_cdo.in | 1 + src/nvim/version.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/test_cdo.in b/src/nvim/testdir/test_cdo.in index fb80ea1164..087cd2ea93 100644 --- a/src/nvim/testdir/test_cdo.in +++ b/src/nvim/testdir/test_cdo.in @@ -2,6 +2,7 @@ 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') diff --git a/src/nvim/version.c b/src/nvim/version.c index 1d98afaaa1..97776efb6f 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -146,7 +146,7 @@ static int included_patches[] = { // 981, // 980, // 979 NA - // 978, + 978, // 977, // 976 NA 975, -- cgit From 1231f0b0015cdcdf344eb815743c4c0dc89ba9ec Mon Sep 17 00:00:00 2001 From: watiko Date: Sun, 10 Jan 2016 23:46:04 +0900 Subject: vim-patch:7.4.980 Problem: Tests for :cdo, :ldo, etc. are outdated. Solution: Add new style tests for these commands. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d --- src/nvim/testdir/Makefile | 5 +- src/nvim/testdir/test_cdo.in | 108 ---------------------- src/nvim/testdir/test_cdo.ok | 66 -------------- src/nvim/testdir/test_cdo.vim | 206 ++++++++++++++++++++++++++++++++++++++++++ src/nvim/version.c | 2 +- 5 files changed, 209 insertions(+), 178 deletions(-) delete mode 100644 src/nvim/testdir/test_cdo.in delete mode 100644 src/nvim/testdir/test_cdo.ok create mode 100644 src/nvim/testdir/test_cdo.vim (limited to 'src') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 8edbe303f2..791e1d90cd 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -29,9 +29,8 @@ SCRIPTS := test_eval.out \ test_charsearch.out \ test_close_count.out \ test_command_count.out \ - test_cdo.out \ -NEW_TESTS = +NEW_TESTS = test_cdo.res SCRIPTS_GUI := test16.out @@ -165,4 +164,4 @@ newtests: newtestssilent newtestssilent: $(NEW_TESTS) %.res: %.vim .gdbinit - $(RUN_VIMTEST) -u runtest.vim $*.vim + $(RUN_VIMTEST) -S runtest.vim $*.vim diff --git a/src/nvim/testdir/test_cdo.in b/src/nvim/testdir/test_cdo.in deleted file mode 100644 index 087cd2ea93..0000000000 --- a/src/nvim/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/nvim/testdir/test_cdo.ok b/src/nvim/testdir/test_cdo.ok deleted file mode 100644 index ddcff4bbb8..0000000000 --- a/src/nvim/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/nvim/testdir/test_cdo.vim b/src/nvim/testdir/test_cdo.vim new file mode 100644 index 0000000000..10cd97c31f --- /dev/null +++ b/src/nvim/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/nvim/version.c b/src/nvim/version.c index 97776efb6f..e057d884f5 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -144,7 +144,7 @@ static int included_patches[] = { // 983, // 982 NA // 981, - // 980, + 980, // 979 NA 978, // 977, -- cgit From 9d184927931a44784136cce58ece63ef9f7bec32 Mon Sep 17 00:00:00 2001 From: watiko Date: Mon, 11 Jan 2016 05:31:33 +0900 Subject: vim-patch:7.4.981 Problem: An error in a test script goes unnoticed. Solution: Source the test script inside try/catch. (Hirohito Higashi) https://github.com/vim/vim/commit/4686b323e4bc0f466500b018959f6c8965f010f9 --- src/nvim/testdir/runtest.vim | 17 ++++++++++------- src/nvim/version.c | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index 0dc142eb97..cca7c751df 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/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/nvim/version.c b/src/nvim/version.c index e057d884f5..406edbfa3c 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -143,7 +143,7 @@ static int included_patches[] = { // 984, // 983, // 982 NA - // 981, + 981, 980, // 979 NA 978, -- cgit From 4eba134a551161384428229fbd80721eb49b5a09 Mon Sep 17 00:00:00 2001 From: watiko Date: Mon, 11 Jan 2016 05:38:54 +0900 Subject: vim-patch:7.4.991 Problem: When running new style tests the output is not visible. Solution: Add the testdir/messages file and show it. Update the list of test names. https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28 --- src/nvim/testdir/Makefile | 5 +++-- src/nvim/testdir/runtest.vim | 17 +++++++++++++++-- src/nvim/version.c | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 791e1d90cd..c4605fe6b4 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -96,6 +96,7 @@ clean: *.rej \ *.orig \ test.log \ + messages \ $(RM_ON_RUN) \ $(RM_ON_START) \ valgrind.* \ @@ -148,7 +149,7 @@ test1.out: .gdbinit test1.in test49.out: test49.vim nolog: - -rm -f test.log + -rm -f test.log messages # New style of tests uses Vim script with assert calls. These are easier @@ -164,4 +165,4 @@ newtests: newtestssilent newtestssilent: $(NEW_TESTS) %.res: %.vim .gdbinit - $(RUN_VIMTEST) -S runtest.vim $*.vim + $(RUN_VIMTEST) -u NONE -S runtest.vim $*.vim diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index cca7c751df..8314a45d0c 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -39,6 +39,7 @@ let testname = expand('%') let done = 0 let fail = 0 let errors = [] +let messages = [] try source % catch @@ -57,6 +58,7 @@ for test in tests call SetUp() endif + call add(messages, 'Executing ' . test) let done += 1 try exe 'call ' . test @@ -92,9 +94,20 @@ if len(errors) > 0 write endif -echo 'Executed ' . done . (done > 1 ? ' tests': ' test') +let message = 'Executed ' . done . (done > 1 ? ' tests': ' test') +echo message +call add(messages, message) if fail > 0 - echo fail . ' FAILED' + let message = fail . ' FAILED' + echo message + call add(messages, message) endif +" Append messages to "messages" +split messages +call append(line('$'), '') +call append(line('$'), 'From ' . testname . ':') +call append(line('$'), messages) +write + qall! diff --git a/src/nvim/version.c b/src/nvim/version.c index 406edbfa3c..8c9faac0c3 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -133,7 +133,7 @@ static int included_patches[] = { // 994 NA // 993, // 992 NA - // 991, + 991, // 990 NA 989, // 988 NA -- cgit From 6f88dca92d24d91414a43f7e765e02abd89d779d Mon Sep 17 00:00:00 2001 From: watiko Date: Tue, 12 Jan 2016 15:05:03 +0900 Subject: tests: Migrate legacy test cdo. --- src/nvim/testdir/Makefile | 2 +- src/nvim/testdir/test_cdo.vim | 206 ------------------------------------------ 2 files changed, 1 insertion(+), 207 deletions(-) delete mode 100644 src/nvim/testdir/test_cdo.vim (limited to 'src') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index c4605fe6b4..bc245b21f4 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -30,7 +30,7 @@ SCRIPTS := test_eval.out \ test_close_count.out \ test_command_count.out \ -NEW_TESTS = test_cdo.res +NEW_TESTS = SCRIPTS_GUI := test16.out diff --git a/src/nvim/testdir/test_cdo.vim b/src/nvim/testdir/test_cdo.vim deleted file mode 100644 index 10cd97c31f..0000000000 --- a/src/nvim/testdir/test_cdo.vim +++ /dev/null @@ -1,206 +0,0 @@ -" 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 -- cgit