]> granicus.if.org Git - vim/commitdiff
patch 9.0.0043: insufficient testing for bracket commands v9.0.0043
authorzeertzjq <zeertzjq@outlook.com>
Wed, 6 Jul 2022 11:57:31 +0000 (12:57 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 6 Jul 2022 11:57:31 +0000 (12:57 +0100)
Problem:    Insufficient testing for bracket commands.
Solution:   Add a few more tests. (closes #10668)

src/testdir/test_normal.vim
src/version.c

index f00dcd0460781f43cd223bc16be4c61e68d7d9a6..86f0ef656b4bbf247fa11e59ace624e87f68bb51 100644 (file)
@@ -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
index 22908e2fe37042357b53a7d7e7af3d0e1de0185b..f1b2e52b10e98fca68b44778779d793ba9d62e71 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    43,
 /**/
     42,
 /**/