+" Test for the comment package
+
source check.vim
source term_util.vim
call assert_equal(["int main() {", " return 0;", "}"], result)
endfunc
-
func Test_mixed_comment()
CheckScreendump
let lines =<< trim END
call assert_equal(["/* int main() { */", "\t/* if 1 { */", "\t /* return 0; */", "\t/* } */", " /* return 1; */", "/* } */"], result)
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()
CheckScreendump
let lines =<< trim END