summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_functions.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-06-30 20:33:01 +0200
committerBram Moolenaar <Bram@vim.org>2019-06-30 20:33:01 +0200
commit892ae723ab95e429222e930cf41b32809567e58e (patch)
treeb13676187124dfbde65761e13bb9791d4ede5775 /src/testdir/test_functions.vim
parent15e248e37f3925d430f96e945d52d3dc423cdc83 (diff)
patch 8.1.1611: bufadd() reuses existing buffer without a namev8.1.1611
Problem: Bufadd() reuses existing buffer without a name. Solution: When the name is empty always create a new buffer.
Diffstat (limited to 'src/testdir/test_functions.vim')
-rw-r--r--src/testdir/test_functions.vim14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 34a4bbf62f..a08cef79d1 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1539,6 +1539,20 @@ func Test_bufadd_bufload()
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'))