aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_functions.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-26 14:38:26 +0800
committerGitHub <noreply@github.com>2022-10-26 14:38:26 +0800
commitc00844aee4d9b607073ff123dfe2e872c9b84954 (patch)
tree837c0973319b8d168db9ccd96d6ae113d29287e7 /src/nvim/testdir/test_functions.vim
parentec33edc7b7027b809ac0b496344367a451e3974a (diff)
parent7b39ce36a4599539cd5cb07dad6bd980d30a3180 (diff)
downloadrneovim-c00844aee4d9b607073ff123dfe2e872c9b84954.tar.gz
rneovim-c00844aee4d9b607073ff123dfe2e872c9b84954.tar.bz2
rneovim-c00844aee4d9b607073ff123dfe2e872c9b84954.zip
Merge pull request #20806 from zeertzjq/vim-8.2.0401
vim-patch:7.4.{1081,1097},8.2.{0401,0418}: eval tests
Diffstat (limited to 'src/nvim/testdir/test_functions.vim')
-rw-r--r--src/nvim/testdir/test_functions.vim30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index 871aab7ff1..7049602d98 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -804,6 +804,10 @@ func Test_getbufvar()
call assert_equal(0, getbufvar(bnr, '&autoindent'))
call assert_equal(0, getbufvar(bnr, '&autoindent', 1))
+ " Set and get a buffer-local variable
+ call setbufvar(bnr, 'bufvar_test', ['one', 'two'])
+ call assert_equal(['one', 'two'], getbufvar(bnr, 'bufvar_test'))
+
" Open new window with forced option values
set fileformats=unix,dos
new ++ff=dos ++bin ++enc=iso-8859-2
@@ -1195,6 +1199,7 @@ func Test_col()
norm gg4|mx6|mY2|
call assert_equal(2, col('.'))
call assert_equal(7, col('$'))
+ call assert_equal(2, col('v'))
call assert_equal(4, col("'x"))
call assert_equal(6, col("'Y"))
call assert_equal(2, [1, 2]->col())
@@ -1205,6 +1210,19 @@ func Test_col()
call assert_equal(0, col([2, '$']))
call assert_equal(0, col([1, 100]))
call assert_equal(0, col([1]))
+
+ " test for getting the visual start column
+ func T()
+ let g:Vcol = col('v')
+ return ''
+ endfunc
+ let g:Vcol = 0
+ xmap <expr> <F2> T()
+ exe "normal gg3|ve\<F2>"
+ call assert_equal(3, g:Vcol)
+ xunmap <F2>
+ delfunc T
+
bw!
endfunc
@@ -1633,6 +1651,10 @@ func Test_func_sandbox()
call assert_fails('call Fsandbox()', 'E48:')
delfunc Fsandbox
+
+ " From a sandbox try to set a predefined variable (which cannot be modified
+ " from a sandbox)
+ call assert_fails('sandbox let v:lnum = 10', 'E794:')
endfunc
func EditAnotherFile()
@@ -2143,14 +2165,6 @@ func Test_range()
" sort()
call assert_equal([0, 1, 2, 3, 4, 5], sort(range(5, 0, -1)))
- " 'spellsuggest'
- func MySuggest()
- return range(3)
- endfunc
- set spell spellsuggest=expr:MySuggest()
- call assert_equal([], spellsuggest('baord', 3))
- set nospell spellsuggest&
-
" string()
call assert_equal('[0, 1, 2, 3, 4]', string(range(5)))