aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_functions.vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-01-01 16:21:55 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-01-01 16:43:38 +0100
commit321a46b724ccb2e574875cf18c8d280f8516527c (patch)
tree46c60d416afea984d83255d5232185aaad8dc4c4 /src/nvim/testdir/test_functions.vim
parent1d8c612f788b1a5c8d74814db4654462e0224831 (diff)
downloadrneovim-321a46b724ccb2e574875cf18c8d280f8516527c.tar.gz
rneovim-321a46b724ccb2e574875cf18c8d280f8516527c.tar.bz2
rneovim-321a46b724ccb2e574875cf18c8d280f8516527c.zip
vim-patch: b:changedtick-related patches
vim-patch:8.0.0334 vim-patch:8.0.0335 vim-patch:8.0.0343 vim-patch:8.0.0345 Problem: Can't access b:changedtick from a dict reference. Solution: Make changedtick a member of the b: dict. (inspired by neovim vim/vim#6112) https://github.com/vim/vim/commit/79518e2ace5fce7b9c49060e462a6e935dba0a84 vim-patch:8.0.0343: b:changedtick can be unlocked Problem: b:changedtick can be unlocked, even though it has no effect. (Nikolai Pavlov) Solution: Add a check and error E940. (closes #1496) vim-patch:8.0.0345: islocked('d.changedtick') does not work Problem: islocked('d.changedtick') does not work. Solution: Make it work. vim-patch:8.0.0335: functions test fails Problem: Functions test fails. Solution: Use the right buffer number. https://github.com/vim/vim/commit/507647da3151f7ffccac1b217936240daa79849c
Diffstat (limited to 'src/nvim/testdir/test_functions.vim')
-rw-r--r--src/nvim/testdir/test_functions.vim42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index 0ce034b63e..398e9ab331 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -311,3 +311,45 @@ func! Test_mode()
bwipe!
iunmap <F2>
endfunc
+
+func Test_getbufvar()
+ let bnr = bufnr('%')
+ let b:var_num = '1234'
+ let def_num = '5678'
+ call assert_equal('1234', getbufvar(bnr, 'var_num'))
+ call assert_equal('1234', getbufvar(bnr, 'var_num', def_num))
+
+ let bd = getbufvar(bnr, '')
+ call assert_equal('1234', bd['var_num'])
+ call assert_true(exists("bd['changedtick']"))
+ call assert_equal(2, len(bd))
+
+ let bd2 = getbufvar(bnr, '', def_num)
+ call assert_equal(bd, bd2)
+
+ unlet b:var_num
+ call assert_equal(def_num, getbufvar(bnr, 'var_num', def_num))
+ call assert_equal('', getbufvar(bnr, 'var_num'))
+
+ let bd = getbufvar(bnr, '')
+ call assert_equal(1, len(bd))
+ let bd = getbufvar(bnr, '',def_num)
+ call assert_equal(1, len(bd))
+
+ call assert_equal('', getbufvar(9999, ''))
+ call assert_equal(def_num, getbufvar(9999, '', def_num))
+ unlet def_num
+
+ call assert_equal(0, getbufvar(bnr, '&autoindent'))
+ call assert_equal(0, getbufvar(bnr, '&autoindent', 1))
+
+ " Open new window with forced option values
+ set fileformats=unix,dos
+ new ++ff=dos ++bin ++enc=iso-8859-2
+ call assert_equal('dos', getbufvar(bufnr('%'), '&fileformat'))
+ call assert_equal(1, getbufvar(bufnr('%'), '&bin'))
+ call assert_equal('iso-8859-2', getbufvar(bufnr('%'), '&fenc'))
+ close
+
+ set fileformats&
+endfunc