diff src/testdir/test_functions.vim @ 20120:16460964c304 v8.2.0615

patch 8.2.0615: regexp benchmark stest is old style Commit: https://github.com/vim/vim/commit/ad48e6c1590842ab6d48e6caba3e9250734dae27 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 21 22:19:45 2020 +0200 patch 8.2.0615: regexp benchmark stest is old style 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 #5963)
author Bram Moolenaar <Bram@vim.org>
date Tue, 21 Apr 2020 22:30:03 +0200
parents e82996ad131f
children 49694eceaa55
line wrap: on
line diff
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -794,18 +794,41 @@ func Test_mode()
   set complete&
 endfunc
 
+" Test for append()
 func Test_append()
   enew!
   split
   call append(0, ["foo"])
+  call append(1, [])
+  call append(1, test_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, test_null_list())
+  call setline(1, ["bar"])
+  call setline(1, [])
+  call setline(1, test_null_list())
+  call setline(2, [])
+  call setline(2, test_null_list())
+  call setline(3, [])
+  call setline(3, test_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'
@@ -913,6 +936,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(test_null_list(), 2))
 endfunc
 
 func Test_matchend()
@@ -1796,6 +1820,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', test_null_list()))
 
   function Mylen() dict
      return len(self.data)
@@ -1962,7 +1987,6 @@ func Test_range()
   execute "normal! a\<C-r>=[complete(col('.'), range(10)), ''][1]\<CR>"
   " complete_info()
   execute "normal! a\<C-r>=[complete(col('.'), range(10)), ''][1]\<CR>\<C-r>=[complete_info(range(5)), ''][1]\<CR>"
-  call assert_fails('call complete(1, ["a"])', 'E785:')
 
   " copy()
   call assert_equal([1, 2, 3], copy(range(1, 3)))