diff src/testdir/test_bufline.vim @ 31164:7831da568864 v9.0.0916

patch 9.0.0916: getbufline() is inefficient for getting a single line Commit: https://github.com/vim/vim/commit/ce30ccc06af7f2c03762e5b18dde37b26ea6ec42 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 21 19:57:04 2022 +0000 patch 9.0.0916: getbufline() is inefficient for getting a single line Problem: getbufline() is inefficient for getting a single line. Solution: Add getbufoneline().
author Bram Moolenaar <Bram@vim.org>
date Mon, 21 Nov 2022 21:00:06 +0100
parents eff0d98467e3
children 87ff5e71d3c2
line wrap: on
line diff
--- a/src/testdir/test_bufline.vim
+++ b/src/testdir/test_bufline.vim
@@ -11,7 +11,9 @@ func Test_setbufline_getbufline()
   hide
   call assert_equal(0, setbufline(b, 1, ['foo', 'bar']))
   call assert_equal(['foo'], getbufline(b, 1))
+  call assert_equal('foo', getbufoneline(b, 1))
   call assert_equal(['bar'], getbufline(b, '$'))
+  call assert_equal('bar', getbufoneline(b, '$'))
   call assert_equal(['foo', 'bar'], getbufline(b, 1, 2))
   exe "bd!" b
   call assert_equal([], getbufline(b, 1, 2))
@@ -35,8 +37,11 @@ func Test_setbufline_getbufline()
 
   call assert_equal(0, setbufline(b, 4, ['d', 'e']))
   call assert_equal(['c'], b->getbufline(3))
+  call assert_equal('c', b->getbufoneline(3))
   call assert_equal(['d'], getbufline(b, 4))
+  call assert_equal('d', getbufoneline(b, 4))
   call assert_equal(['e'], getbufline(b, 5))
+  call assert_equal('e', getbufoneline(b, 5))
   call assert_equal([], getbufline(b, 6))
   call assert_equal([], getbufline(b, 2, 1))