aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_functions.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-02-06 05:18:02 +0800
committerGitHub <noreply@github.com>2022-02-06 05:18:02 +0800
commitb17f1e6fe86ae44676647ef939b361f54d95cd4d (patch)
treeac9ac6bd464b36bc1c71c6b5282846f26fbe50f9 /src/nvim/testdir/test_functions.vim
parent92e92f02e7106fcad1597bb8f0edf1e43186a07f (diff)
parentbe9dbc925ce66a8880ac9ccc68e3ac902b322de0 (diff)
downloadrneovim-b17f1e6fe86ae44676647ef939b361f54d95cd4d.tar.gz
rneovim-b17f1e6fe86ae44676647ef939b361f54d95cd4d.tar.bz2
rneovim-b17f1e6fe86ae44676647ef939b361f54d95cd4d.zip
Merge pull request #17077 from zeertzjq/vim-8.2.2324
vim-patch:8.2.{1727,2324,2363}: charcol(), getcharpos(), getcursorcharpos(), setcharpos(), setcursorcharpos()
Diffstat (limited to 'src/nvim/testdir/test_functions.vim')
-rw-r--r--src/nvim/testdir/test_functions.vim27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index 42facdd491..6c2b0b97b6 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -1712,6 +1712,33 @@ func Test_nr2char()
call assert_equal("\x80\xfc\b\xfd\x80\xfeX\x80\xfeX\x80\xfeX\x80\xfeX\x80\xfeX", eval('"\<M-' .. nr2char(0x40000000) .. '>"'))
endfunc
+" Test for getcurpos() and setpos()
+func Test_getcurpos_setpos()
+ new
+ call setline(1, ['012345678', '012345678'])
+ normal gg6l
+ let sp = getcurpos()
+ normal 0
+ call setpos('.', sp)
+ normal jyl
+ call assert_equal('6', @")
+ call assert_equal(-1, setpos('.', v:_null_list))
+ call assert_equal(-1, setpos('.', {}))
+
+ let winid = win_getid()
+ normal G$
+ let pos = getcurpos()
+ wincmd w
+ call assert_equal(pos, getcurpos(winid))
+
+ wincmd w
+ close!
+
+ call assert_equal(getcurpos(), getcurpos(0))
+ call assert_equal([0, 0, 0, 0, 0], getcurpos(-1))
+ call assert_equal([0, 0, 0, 0, 0], getcurpos(1999))
+endfunc
+
func HasDefault(msg = 'msg')
return a:msg
endfunc