diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-08-22 22:39:28 -0400 |
|---|---|---|
| committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-08-23 07:46:51 -0400 |
| commit | 9358979d096a6bfde371bbca5c77f8d45a4de253 (patch) | |
| tree | 5572ed3ba56cd16f915ddd4182943b2be3350a98 /src/nvim/testdir | |
| parent | c6eb1f42bec06e92c2c5ee9a523af4e46ac05083 (diff) | |
| download | rneovim-9358979d096a6bfde371bbca5c77f8d45a4de253.tar.gz rneovim-9358979d096a6bfde371bbca5c77f8d45a4de253.tar.bz2 rneovim-9358979d096a6bfde371bbca5c77f8d45a4de253.zip | |
vim-patch:8.1.0037: cannot easily append lines to another buffer
Problem: Cannot easily append lines to another buffer.
Solution: Add appendbufline().
https://github.com/vim/vim/commit/ca851593a660f08aba5c134f90c238d4a3e983e6
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_bufline.vim | 27 | ||||
| -rw-r--r-- | src/nvim/testdir/test_edit.vim | 2 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_bufline.vim b/src/nvim/testdir/test_bufline.vim index b886e99506..b110c44eb1 100644 --- a/src/nvim/testdir/test_bufline.vim +++ b/src/nvim/testdir/test_bufline.vim @@ -1,4 +1,4 @@ -" Tests for setbufline() and getbufline() +" Tests for setbufline(), getbufline(), appendbufline() source shared.vim @@ -65,3 +65,28 @@ func Test_setline_startup() call delete('Xscript') call delete('Xtest') endfunc + +func Test_appendbufline() + new + let b = bufnr('%') + hide + call assert_equal(0, appendbufline(b, 0, ['foo', 'bar'])) + call assert_equal(['foo'], getbufline(b, 1)) + call assert_equal(['bar'], getbufline(b, 2)) + call assert_equal(['foo', 'bar'], getbufline(b, 1, 2)) + exe "bd!" b + call assert_equal([], getbufline(b, 1, 2)) + + split Xtest + call setline(1, ['a', 'b', 'c']) + let b = bufnr('%') + wincmd w + call assert_equal(1, appendbufline(b, 4, ['x'])) + call assert_equal(1, appendbufline(1234, 1, ['x'])) + call assert_equal(0, appendbufline(b, 3, ['d', 'e'])) + call assert_equal(['c'], getbufline(b, 3)) + call assert_equal(['d'], getbufline(b, 4)) + call assert_equal(['e'], getbufline(b, 5)) + call assert_equal([], getbufline(b, 6)) + exe "bwipe! " . b +endfunc diff --git a/src/nvim/testdir/test_edit.vim b/src/nvim/testdir/test_edit.vim index 827c54e704..1010ae4e09 100644 --- a/src/nvim/testdir/test_edit.vim +++ b/src/nvim/testdir/test_edit.vim @@ -537,7 +537,7 @@ func! Test_edit_CTRL_I() " Tab in completion mode let path=expand("%:p:h") new - call setline(1, [path."/", '']) + call setline(1, [path. "/", '']) call feedkeys("Arunt\<c-x>\<c-f>\<tab>\<cr>\<esc>", 'tnix') call assert_match('runtest\.vim', getline(1)) %d |