diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-02-03 12:09:37 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-02-11 19:03:27 +0100 |
commit | 348193f49c45c5ba74ce367a7fa192308f50e746 (patch) | |
tree | 4432c023829db8181f582d2e41704da51beaf66d | |
parent | 48af5991b9ac24df48a384b41840617f5d0ff096 (diff) | |
download | rneovim-348193f49c45c5ba74ce367a7fa192308f50e746.tar.gz rneovim-348193f49c45c5ba74ce367a7fa192308f50e746.tar.bz2 rneovim-348193f49c45c5ba74ce367a7fa192308f50e746.zip |
vim-patch:8.0.1222: test functions interfere with each other
Problem: Test functions interfere with each other.
Solution: Cleanup tab pages, windows and buffers. Reset option.
https://github.com/vim/vim/commit/ce11de87e26e1420703242f8e07b4fd69c4032ba
-rw-r--r-- | src/nvim/testdir/runtest.vim | 14 | ||||
-rw-r--r-- | src/nvim/testdir/test_filetype.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_tabpage.vim | 3 |
3 files changed, 16 insertions, 3 deletions
diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index daef9e146c..1f23530d82 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -110,7 +110,11 @@ func RunTheTest(test) endtry endif - " Close any extra windows and make the current one not modified. + " Close any extra tab pages and windows and make the current one not modified. + while tabpagenr('$') > 1 + bwipe! + endwhile + while 1 let wincount = winnr('$') if wincount == 1 @@ -123,7 +127,15 @@ func RunTheTest(test) break endif endwhile + + " Wipe out all buffers except the current one, then wipe the current one. + for nr in range(1, bufnr('$')) + if nr != bufnr('%') && bufexists(nr) + exe nr . 'bwipe!' + endif + endfor set nomodified + bwipe endfunc func AfterTheTest() diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 4348f3b6f6..43dc383f3d 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -547,7 +547,7 @@ func Test_script_detection() for file in files call writefile(file, 'Xtest') split Xtest - call assert_equal(ft, &filetype) + call assert_equal(ft, &filetype, 'for text: ' . string(file)) bwipe! endfor endfor diff --git a/src/nvim/testdir/test_tabpage.vim b/src/nvim/testdir/test_tabpage.vim index 51f2477209..180563ebbd 100644 --- a/src/nvim/testdir/test_tabpage.vim +++ b/src/nvim/testdir/test_tabpage.vim @@ -475,6 +475,7 @@ endfunc func Test_close_on_quitpre() " This once caused a crash + edit Xtest new only set bufhidden=delete @@ -489,7 +490,7 @@ func Test_close_on_quitpre() while tabpagenr('$') > 1 bwipe! endwhile - 1b + buf Xtest endfunc " vim: shiftwidth=2 sts=2 expandtab |