comparison src/testdir/test_functions.vim @ 19902:481e8fa158b4 v8.2.0507

patch 8.2.0507: getbufvar() may get the wrong dictionary Commit: https://github.com/vim/vim/commit/5259275347667a90fb88d8ea74331f88ad68edfc Author: Bram Moolenaar <Bram@vim.org> Date: Fri Apr 3 18:43:35 2020 +0200 patch 8.2.0507: getbufvar() may get the wrong dictionary Problem: Getbufvar() may get the wrong dictionary. (David le Blanc) Solution: Check for empty name. (closes https://github.com/vim/vim/issues/5878)
author Bram Moolenaar <Bram@vim.org>
date Fri, 03 Apr 2020 18:45:04 +0200
parents 1c7f92a1100e
children 031184ace7c5
comparison
equal deleted inserted replaced
19901:e3cdf97099bb 19902:481e8fa158b4
839 call assert_equal('dos', getbufvar(bufnr('%'), '&fileformat')) 839 call assert_equal('dos', getbufvar(bufnr('%'), '&fileformat'))
840 call assert_equal(1, getbufvar(bufnr('%'), '&bin')) 840 call assert_equal(1, getbufvar(bufnr('%'), '&bin'))
841 call assert_equal('iso-8859-2', getbufvar(bufnr('%'), '&fenc')) 841 call assert_equal('iso-8859-2', getbufvar(bufnr('%'), '&fenc'))
842 close 842 close
843 843
844 " Get the b: dict.
845 let b:testvar = 'one'
846 new
847 let b:testvar = 'two'
848 let thebuf = bufnr()
849 wincmd w
850 call assert_equal('two', getbufvar(thebuf, 'testvar'))
851 call assert_equal('two', getbufvar(thebuf, '').testvar)
852 bwipe!
853
844 set fileformats& 854 set fileformats&
845 endfunc 855 endfunc
846 856
847 func Test_last_buffer_nr() 857 func Test_last_buffer_nr()
848 call assert_equal(bufnr('$'), last_buffer_nr()) 858 call assert_equal(bufnr('$'), last_buffer_nr())