aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_functions.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-05 12:26:17 +0800
committerGitHub <noreply@github.com>2022-11-05 12:26:17 +0800
commita86295cd5c2bf15a11eb05e226fd8e226154f6a6 (patch)
tree2b92fca7058bea9087cae7fadca3e425c73b07f9 /src/nvim/testdir/test_functions.vim
parentdaf9a63d67254342382cf79f1cd216f8e5722579 (diff)
downloadrneovim-a86295cd5c2bf15a11eb05e226fd8e226154f6a6.tar.gz
rneovim-a86295cd5c2bf15a11eb05e226fd8e226154f6a6.tar.bz2
rneovim-a86295cd5c2bf15a11eb05e226fd8e226154f6a6.zip
vim-patch:8.2.0615: regexp benchmark stest is old style (#20940)
Problem: Regexp benchmark stest is old style. Solution: Make it a new style test. Fix using a NULL list. Add more tests. (Yegappan Lakshmanan, closes vim/vim#5963) https://github.com/vim/vim/commit/ad48e6c1590842ab6d48e6caba3e9250734dae27 N/A patches: vim-patch:9.0.0829: wrong counts in macro comment
Diffstat (limited to 'src/nvim/testdir/test_functions.vim')
-rw-r--r--src/nvim/testdir/test_functions.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index 5718266dae..1ba0cf9080 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -798,18 +798,41 @@ func Test_mode()
delfunction OperatorFunc
endfunc
+" Test for append()
func Test_append()
enew!
split
call append(0, ["foo"])
+ call append(1, [])
+ call append(1, v:_null_list)
+ call assert_equal(['foo', ''], getline(1, '$'))
split
only
undo
+ undo
" Using $ instead of '$' must give an error
call assert_fails("call append($, 'foobar')", 'E116:')
endfunc
+" Test for setline()
+func Test_setline()
+ new
+ call setline(0, ["foo"])
+ call setline(0, [])
+ call setline(0, v:_null_list)
+ call setline(1, ["bar"])
+ call setline(1, [])
+ call setline(1, v:_null_list)
+ call setline(2, [])
+ call setline(2, v:_null_list)
+ call setline(3, [])
+ call setline(3, v:_null_list)
+ call setline(2, ["baz"])
+ call assert_equal(['bar', 'baz'], getline(1, '$'))
+ close!
+endfunc
+
func Test_getbufvar()
let bnr = bufnr('%')
let b:var_num = '1234'
@@ -917,6 +940,7 @@ func Test_match_func()
call assert_equal(-1, match(['a', 'b', 'c', 'a'], 'a', 5))
call assert_equal(4, match('testing', 'ing', -1))
call assert_fails("let x=match('testing', 'ing', 0, [])", 'E745:')
+ call assert_equal(-1, match(v:_null_list, 2))
endfunc
func Test_matchend()
@@ -1922,6 +1946,7 @@ func Test_call()
call assert_equal(3, 'len'->call([123]))
call assert_fails("call call('len', 123)", 'E714:')
call assert_equal(0, call('', []))
+ call assert_equal(0, call('len', v:_null_list))
function Mylen() dict
return len(self.data)