]> granicus.if.org Git - vim/commitdiff
patch 8.2.4326: "o" and "O" copying comment not sufficiently tested v8.2.4326
authorzeertzjq <zeertzjq@outlook.com>
Tue, 8 Feb 2022 12:58:37 +0000 (12:58 +0000)
committerBram Moolenaar <Bram@vim.org>
Tue, 8 Feb 2022 12:58:37 +0000 (12:58 +0000)
Problem:    "o" and "O" copying comment not sufficiently tested.
Solution:   Add a test case. (closes #9718)

src/testdir/test_textformat.vim
src/version.c

index 640298929728fa0562d30b18da1f353aab3a4106..385021396d4cb93515a3f61585e98fbdb73f1171 100644 (file)
@@ -238,7 +238,33 @@ func Test_format_c_comment()
   END
   call assert_equal(expected, getline(1, '$'))
 
-  " Using "o" repeats the line comment, "O" does not.
+  " Using either "o" or "O" repeats a line comment occupying a whole line.
+  %del
+  let text =<< trim END
+      nop;
+      // This is a comment
+      val = val;
+  END
+  call setline(1, text)
+  normal 2Go
+  let expected =<< trim END
+      nop;
+      // This is a comment
+      //
+      val = val;
+  END
+  call assert_equal(expected, getline(1, '$'))
+  normal 2GO
+  let expected =<< trim END
+      nop;
+      //
+      // This is a comment
+      //
+      val = val;
+  END
+  call assert_equal(expected, getline(1, '$'))
+
+  " Using "o" repeats a line comment after a statement, "O" does not.
   %del
   let text =<< trim END
       nop;
index ff7f2f029154ad3677899afb461532b1581da23c..82d12a04b40bc7fae065ccc8473ec97401892780 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4326,
 /**/
     4325,
 /**/