mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.1.1254: need more tests for the comment plugin
Problem: need more tests for the comment plugin Solution: add a tests for the [gb]:comment_first_col setting (Maxim Kim) closes: #16995 Signed-off-by: Maxim Kim <habamax@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
ce80c59bfd
commit
aa68f8a095
@ -1,3 +1,5 @@
|
|||||||
|
" Test for the comment package
|
||||||
|
|
||||||
source check.vim
|
source check.vim
|
||||||
source term_util.vim
|
source term_util.vim
|
||||||
|
|
||||||
@ -105,7 +107,6 @@ func Test_bothends_uncomment()
|
|||||||
call assert_equal(["int main() {", " return 0;", "}"], result)
|
call assert_equal(["int main() {", " return 0;", "}"], result)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
|
||||||
func Test_mixed_comment()
|
func Test_mixed_comment()
|
||||||
CheckScreendump
|
CheckScreendump
|
||||||
let lines =<< trim END
|
let lines =<< trim END
|
||||||
@ -177,6 +178,56 @@ func Test_mixed_indent_comment()
|
|||||||
call assert_equal(["/* int main() { */", "\t/* if 1 { */", "\t /* return 0; */", "\t/* } */", " /* return 1; */", "/* } */"], result)
|
call assert_equal(["/* int main() { */", "\t/* if 1 { */", "\t /* return 0; */", "\t/* } */", " /* return 1; */", "/* } */"], result)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_buffer_first_col_comment()
|
||||||
|
CheckScreendump
|
||||||
|
let lines =<< trim END
|
||||||
|
def Hello():
|
||||||
|
print("Hello")
|
||||||
|
pass
|
||||||
|
END
|
||||||
|
|
||||||
|
let input_file = "test_first_col_comment_input.py"
|
||||||
|
call writefile(lines, input_file, "D")
|
||||||
|
|
||||||
|
let buf = RunVimInTerminal('-c "packadd comment" -c "let b:comment_first_col=1" ' .. input_file, {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "jgcc")
|
||||||
|
let output_file = "comment_first_col_test.py"
|
||||||
|
call term_sendkeys(buf, $":w {output_file}\<CR>")
|
||||||
|
defer delete(output_file)
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
|
||||||
|
let result = readfile(output_file)
|
||||||
|
|
||||||
|
call assert_equal(["def Hello():", '# print("Hello")', " pass"], result)
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_global_first_col_comment()
|
||||||
|
CheckScreendump
|
||||||
|
let lines =<< trim END
|
||||||
|
def Hello():
|
||||||
|
print("Hello")
|
||||||
|
pass
|
||||||
|
END
|
||||||
|
|
||||||
|
let input_file = "test_first_col_comment_input.py"
|
||||||
|
call writefile(lines, input_file, "D")
|
||||||
|
|
||||||
|
let buf = RunVimInTerminal('-c "packadd comment" -c "let g:comment_first_col=1" ' .. input_file, {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "jgcj")
|
||||||
|
let output_file = "comment_first_col_test.py"
|
||||||
|
call term_sendkeys(buf, $":w {output_file}\<CR>")
|
||||||
|
defer delete(output_file)
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
|
||||||
|
let result = readfile(output_file)
|
||||||
|
|
||||||
|
call assert_equal(["def Hello():", '# print("Hello")', "# pass"], result)
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_textobj_icomment()
|
func Test_textobj_icomment()
|
||||||
CheckScreendump
|
CheckScreendump
|
||||||
let lines =<< trim END
|
let lines =<< trim END
|
||||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1254,
|
||||||
/**/
|
/**/
|
||||||
1253,
|
1253,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user