diff src/testdir/test_bufline.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 c087099e9163
children 2fb397573541
line wrap: on
line diff
--- a/src/testdir/test_bufline.vim
+++ b/src/testdir/test_bufline.vim
@@ -19,8 +19,19 @@ func Test_setbufline_getbufline()
   call setline(1, ['a', 'b', 'c'])
   let b = bufnr('%')
   wincmd w
+
+  call assert_equal(1, setbufline(b, 5, 'x'))
   call assert_equal(1, setbufline(b, 5, ['x']))
+  call assert_equal(1, setbufline(b, 5, []))
+  call assert_equal(1, setbufline(b, 5, test_null_list()))
+
+  call assert_equal(1, 'x'->setbufline(bufnr('$') + 1, 1))
   call assert_equal(1, ['x']->setbufline(bufnr('$') + 1, 1))
+  call assert_equal(1, []->setbufline(bufnr('$') + 1, 1))
+  call assert_equal(1, test_null_list()->setbufline(bufnr('$') + 1, 1))
+
+  call assert_equal(['a', 'b', 'c'], getbufline(b, 1, '$'))
+
   call assert_equal(0, setbufline(b, 4, ['d', 'e']))
   call assert_equal(['c'], b->getbufline(3))
   call assert_equal(['d'], getbufline(b, 4))
@@ -83,9 +94,29 @@ func Test_appendbufline()
   call setline(1, ['a', 'b', 'c'])
   let b = bufnr('%')
   wincmd w
+
+  call assert_equal(1, appendbufline(b, -1, 'x'))
   call assert_equal(1, appendbufline(b, -1, ['x']))
+  call assert_equal(1, appendbufline(b, -1, []))
+  call assert_equal(1, appendbufline(b, -1, test_null_list()))
+
+  call assert_equal(1, appendbufline(b, 4, 'x'))
   call assert_equal(1, appendbufline(b, 4, ['x']))
+  call assert_equal(1, appendbufline(b, 4, []))
+  call assert_equal(1, appendbufline(b, 4, test_null_list()))
+
+  call assert_equal(1, appendbufline(1234, 1, 'x'))
   call assert_equal(1, appendbufline(1234, 1, ['x']))
+  call assert_equal(1, appendbufline(1234, 1, []))
+  call assert_equal(1, appendbufline(1234, 1, test_null_list()))
+
+  call assert_equal(0, appendbufline(b, 1, []))
+  call assert_equal(0, appendbufline(b, 1, test_null_list()))
+  call assert_equal(1, appendbufline(b, 3, []))
+  call assert_equal(1, appendbufline(b, 3, test_null_list()))
+
+  call assert_equal(['a', 'b', 'c'], getbufline(b, 1, '$'))
+
   call assert_equal(0, appendbufline(b, 3, ['d', 'e']))
   call assert_equal(['c'], getbufline(b, 3))
   call assert_equal(['d'], getbufline(b, 4))