diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-07-13 12:36:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-13 12:36:32 +0200 |
commit | e1fae8f1fe940db6a0ecddfcf88afeaacf6bb9d4 (patch) | |
tree | 0a8853953c37a87fa6326b805015ba455fbfec58 /src/nvim/testdir/test_functions.vim | |
parent | 06826139e121fb4e003ac409bd17ebb7428d19fd (diff) | |
parent | b9474b0641d0a91a639a77876edd2f5c918f9a70 (diff) | |
download | rneovim-e1fae8f1fe940db6a0ecddfcf88afeaacf6bb9d4.tar.gz rneovim-e1fae8f1fe940db6a0ecddfcf88afeaacf6bb9d4.tar.bz2 rneovim-e1fae8f1fe940db6a0ecddfcf88afeaacf6bb9d4.zip |
Merge #10435 from Shougo/vim-8.1.1610
Diffstat (limited to 'src/nvim/testdir/test_functions.vim')
-rw-r--r-- | src/nvim/testdir/test_functions.vim | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 0c3c356622..615536baef 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1188,3 +1188,45 @@ func Test_libcall_libcallnr() call assert_fails("call libcall('Xdoesnotexist_', 'getenv', 'HOME')", 'E364:') call assert_fails("call libcallnr('Xdoesnotexist_', 'strlen', 'abcd')", 'E364:') endfunc + +func Test_bufadd_bufload() + call assert_equal(0, bufexists('someName')) + let buf = bufadd('someName') + call assert_notequal(0, buf) + call assert_equal(1, bufexists('someName')) + call assert_equal(0, getbufvar(buf, '&buflisted')) + call assert_equal(0, bufloaded(buf)) + call bufload(buf) + call assert_equal(1, bufloaded(buf)) + call assert_equal([''], getbufline(buf, 1, '$')) + + let curbuf = bufnr('') + call writefile(['some', 'text'], 'otherName') + let buf = bufadd('otherName') + call assert_notequal(0, buf) + call assert_equal(1, bufexists('otherName')) + call assert_equal(0, getbufvar(buf, '&buflisted')) + call assert_equal(0, bufloaded(buf)) + call bufload(buf) + call assert_equal(1, bufloaded(buf)) + call assert_equal(['some', 'text'], getbufline(buf, 1, '$')) + call assert_equal(curbuf, bufnr('')) + + let buf1 = bufadd('') + let buf2 = bufadd('') + call assert_notequal(0, buf1) + call assert_notequal(0, buf2) + call assert_notequal(buf1, buf2) + call assert_equal(1, bufexists(buf1)) + call assert_equal(1, bufexists(buf2)) + call assert_equal(0, bufloaded(buf1)) + exe 'bwipe ' .. buf1 + call assert_equal(0, bufexists(buf1)) + call assert_equal(1, bufexists(buf2)) + exe 'bwipe ' .. buf2 + call assert_equal(0, bufexists(buf2)) + + bwipe someName + bwipe otherName + call assert_equal(0, bufexists('someName')) +endfunc |