changeset 29401:23f44007f65d v9.0.0043

patch 9.0.0043: insufficient testing for bracket commands Commit: https://github.com/vim/vim/commit/cf34434b5e840dda4a21cd9c0bee24e3e43a674d Author: zeertzjq <zeertzjq@outlook.com> Date: Wed Jul 6 12:57:31 2022 +0100 patch 9.0.0043: insufficient testing for bracket commands Problem: Insufficient testing for bracket commands. Solution: Add a few more tests. (closes https://github.com/vim/vim/issues/10668)
author Bram Moolenaar <Bram@vim.org>
date Wed, 06 Jul 2022 14:00:05 +0200
parents 627e04fe3459
children cc9945ae0971
files src/testdir/test_normal.vim src/version.c
diffstat 2 files changed, 39 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -1994,9 +1994,16 @@ func Test_normal27_bracket()
   call assert_equal(5, line('.'))
   call assert_equal(3, col('.'))
 
-  " No mark after line 21, cursor moves to first non blank on current line
+  " No mark before line 1, cursor moves to first non-blank on current line
+  1
+  norm! 5|['
+  call assert_equal('  1   b', getline('.'))
+  call assert_equal(1, line('.'))
+  call assert_equal(3, col('.'))
+
+  " No mark after line 21, cursor moves to first non-blank on current line
   21
-  norm! $]'
+  norm! 5|]'
   call assert_equal('  21   b', getline('.'))
   call assert_equal(21, line('.'))
   call assert_equal(3, col('.'))
@@ -2013,6 +2020,34 @@ func Test_normal27_bracket()
   call assert_equal(20, line('.'))
   call assert_equal(8, col('.'))
 
+  " No mark before line 1, cursor does not move
+  1
+  norm! 5|[`
+  call assert_equal('  1   b', getline('.'))
+  call assert_equal(1, line('.'))
+  call assert_equal(5, col('.'))
+
+  " No mark after line 21, cursor does not move
+  21
+  norm! 5|]`
+  call assert_equal('  21   b', getline('.'))
+  call assert_equal(21, line('.'))
+  call assert_equal(5, col('.'))
+
+  " Count too large for [`
+  " cursor moves to first lowercase mark
+  norm! 99[`
+  call assert_equal('  1   b', getline('.'))
+  call assert_equal(1, line('.'))
+  call assert_equal(7, col('.'))
+
+  " Count too large for ]`
+  " cursor moves to last lowercase mark
+  norm! 99]`
+  call assert_equal('  20   b', getline('.'))
+  call assert_equal(20, line('.'))
+  call assert_equal(8, col('.'))
+
   " clean up
   bw!
 endfunc
--- a/src/version.c
+++ b/src/version.c
@@ -736,6 +736,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    43,
+/**/
     42,
 /**/
     41,