blob: 1c50748137e207b84aa46ca7a0184ad87c95ac75 [file] [log] [blame]
Maxim Kimaa68f8a2025-03-28 19:17:53 +01001" Test for the comment package
2
Maxim Kim51ff18e2025-03-19 20:54:12 +01003source check.vim
4source term_util.vim
5
6func Test_basic_comment()
7 CheckScreendump
8 let lines =<< trim END
9 vim9script
10
11 def Hello()
12 echo "Hello"
13 enddef
14 END
15
16 let input_file = "test_basic_comment_input.vim"
17 call writefile(lines, input_file, "D")
18
19 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
20
21 call term_sendkeys(buf, "gcc")
22 call term_sendkeys(buf, "2jgcip")
23 let output_file = "comment_basic_test.vim"
24 call term_sendkeys(buf, $":w {output_file}\<CR>")
25 defer delete(output_file)
26
27 call StopVimInTerminal(buf)
28
29 let result = readfile(output_file)
30
31 call assert_equal(["# vim9script", "", "# def Hello()", '# echo "Hello"', "# enddef"], result)
32endfunc
33
Maxim Kim51ff18e2025-03-19 20:54:12 +010034func Test_basic_uncomment()
35 CheckScreendump
36 let lines =<< trim END
37 vim9script
38
39 # def Hello()
40 # echo "Hello"
41 # enddef
42 END
43
44 let input_file = "test_basic_uncomment_input.vim"
45 call writefile(lines, input_file, "D")
46
47 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
48
49 call term_sendkeys(buf, "gcc")
50 call term_sendkeys(buf, "2jgcip")
51 let output_file = "uncomment_basic_test.vim"
52 call term_sendkeys(buf, $":w {output_file}\<CR>")
53 defer delete(output_file)
54
55 call StopVimInTerminal(buf)
56
57 let result = readfile(output_file)
58
Maxim Kim9712a252025-03-21 18:02:56 +010059 call assert_equal(["# vim9script", "", "def Hello()", ' echo "Hello"', "enddef"], result)
Maxim Kim51ff18e2025-03-19 20:54:12 +010060endfunc
61
Maxim Kim532a5fb2025-06-12 21:31:00 +020062func Test_backward_slash_uncomment()
63 " Note this test depends on 'commentstring' setting in nroff ftplugin
64 CheckScreendump
65 let lines =<< trim END
66 .\" .TL Test backward slash uncomment
67 END
68
69 let input_file = "Test_backward_slash_uncomment_input.mom"
70 call writefile(lines, input_file, "D")
71
72 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
73
74 call term_sendkeys(buf, "gcc")
75 let output_file = "backward_slash_uncomment_test.mom"
76 call term_sendkeys(buf, $":w {output_file}\<CR>")
77 defer delete(output_file)
78
79 call StopVimInTerminal(buf)
80
81 let result = readfile(output_file)
82
83 call assert_equal([".TL Test backward slash uncomment"], result)
84endfunc
85
Maxim Kimdd776dd2025-04-22 20:11:05 +020086func Test_caseinsensitive_uncomment()
87 CheckScreendump
88 let lines =<< trim END
89 rem echo "Hello"
90 END
91
92 let input_file = "test_caseinsensitive_uncomment_input.bat"
93 call writefile(lines, input_file, "D")
94
95 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
96
97 call term_sendkeys(buf, "gcc")
98 let output_file = "comment_testinsensitive_uncomment_test.bat"
99 call term_sendkeys(buf, $":w {output_file}\<CR>")
100 defer delete(output_file)
101
102 call StopVimInTerminal(buf)
103
104 let result = readfile(output_file)
105
106 call assert_equal(['echo "Hello"'], result)
107endfunc
108
Maxim Kim51ff18e2025-03-19 20:54:12 +0100109func Test_bothends_comment()
110 CheckScreendump
111 let lines =<< trim END
112 int main() {}
113 END
114
115 let input_file = "test_bothends_comment_input.c"
116 call writefile(lines, input_file, "D")
117
118 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
119
120 call term_sendkeys(buf, "gcc")
121 let output_file = "comment_bothends_test.c"
122 call term_sendkeys(buf, $":w {output_file}\<CR>")
123 defer delete(output_file)
124
125 call StopVimInTerminal(buf)
126
127 let result = readfile(output_file)
128
129 call assert_equal(["/* int main() {} */"], result)
130endfunc
131
132func Test_bothends_uncomment()
133 CheckScreendump
134 let lines =<< trim END
135 /* int main() { */
136 /* return 0; */
137 /* } */
138 END
139
140 let input_file = "test_bothends_uncomment_input.c"
141 call writefile(lines, input_file, "D")
142
143 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
144
145 call term_sendkeys(buf, "gcip")
146 let output_file = "uncomment_bothends_test.c"
147 call term_sendkeys(buf, $":w {output_file}\<CR>")
148 defer delete(output_file)
149
150 call StopVimInTerminal(buf)
151
152 let result = readfile(output_file)
153
154 call assert_equal(["int main() {", " return 0;", "}"], result)
155endfunc
156
Maxim Kim51ff18e2025-03-19 20:54:12 +0100157func Test_mixed_comment()
158 CheckScreendump
159 let lines =<< trim END
160 for x in range(10):
161 # print(x)
162 # print(x*x)
163 END
164
165 let input_file = "test_mixed_comment_input.py"
166 call writefile(lines, input_file, "D")
167
168 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
169
170 call term_sendkeys(buf, "gcG")
171 let output_file = "comment_mixed_test.py"
172 call term_sendkeys(buf, $":w {output_file}\<CR>")
173 defer delete(output_file)
174
175 call StopVimInTerminal(buf)
176
177 let result = readfile(output_file)
178
179 call assert_equal(["# for x in range(10):", "# # print(x)", "# # print(x*x)"], result)
180endfunc
181
182func Test_mixed_comment2()
183 CheckScreendump
184 let lines =<< trim END
185 # for x in range(10):
186 print(x)
187 # print(x*x)
188 END
189
190 let input_file = "test_mixed_comment_input2.py"
191 call writefile(lines, input_file, "D")
192
193 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
194
195 call term_sendkeys(buf, "gcG")
196 let output_file = "comment_mixed_test2.py"
197 call term_sendkeys(buf, $":w {output_file}\<CR>")
198 defer delete(output_file)
199
200 call StopVimInTerminal(buf)
201
202 let result = readfile(output_file)
203
204 call assert_equal(["# # for x in range(10):", "# print(x)", "# # print(x*x)"], result)
205endfunc
206
207func Test_mixed_indent_comment()
208 CheckScreendump
209 let lines = ["int main() {", "\tif 1 {", "\t return 0;", "\t}", " return 1;", "}"]
210
211 let input_file = "test_mixed_indent_comment_input.c"
212 call writefile(lines, input_file, "D")
213
214 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
215
216 call term_sendkeys(buf, "gcip")
217 let output_file = "comment_mixed_indent_test.c"
218 call term_sendkeys(buf, $":w {output_file}\<CR>")
219 defer delete(output_file)
220
221 call StopVimInTerminal(buf)
222
223 let result = readfile(output_file)
224
225 call assert_equal(["/* int main() { */", "\t/* if 1 { */", "\t /* return 0; */", "\t/* } */", " /* return 1; */", "/* } */"], result)
226endfunc
Maxim Kim9712a252025-03-21 18:02:56 +0100227
Maxim Kimaa68f8a2025-03-28 19:17:53 +0100228func Test_buffer_first_col_comment()
229 CheckScreendump
230 let lines =<< trim END
231 def Hello():
232 print("Hello")
233 pass
234 END
235
236 let input_file = "test_first_col_comment_input.py"
237 call writefile(lines, input_file, "D")
238
239 let buf = RunVimInTerminal('-c "packadd comment" -c "let b:comment_first_col=1" ' .. input_file, {})
240
241 call term_sendkeys(buf, "jgcc")
242 let output_file = "comment_first_col_test.py"
243 call term_sendkeys(buf, $":w {output_file}\<CR>")
244 defer delete(output_file)
245
246 call StopVimInTerminal(buf)
247
248 let result = readfile(output_file)
249
250 call assert_equal(["def Hello():", '# print("Hello")', " pass"], result)
251endfunc
252
253func Test_global_first_col_comment()
254 CheckScreendump
255 let lines =<< trim END
256 def Hello():
257 print("Hello")
258 pass
259 END
260
261 let input_file = "test_first_col_comment_input.py"
262 call writefile(lines, input_file, "D")
263
264 let buf = RunVimInTerminal('-c "packadd comment" -c "let g:comment_first_col=1" ' .. input_file, {})
265
266 call term_sendkeys(buf, "jgcj")
267 let output_file = "comment_first_col_test.py"
268 call term_sendkeys(buf, $":w {output_file}\<CR>")
269 defer delete(output_file)
270
271 call StopVimInTerminal(buf)
272
273 let result = readfile(output_file)
274
275 call assert_equal(["def Hello():", '# print("Hello")', "# pass"], result)
276endfunc
277
Maxim Kim9712a252025-03-21 18:02:56 +0100278func Test_textobj_icomment()
279 CheckScreendump
280 let lines =<< trim END
281 for x in range(10):
282 print(x) # printing stuff
283 # print(x*x)
284 #print(x*x*x)
285 print(x*x*x*x) # printing stuff
286 print(x*x*x*x*x) # printing stuff
287 # print(x*x)
288 #print(x*x*x)
289
290 print(x*x*x*x*x)
291 END
292
293 let input_file = "test_textobj_icomment_input.py"
294 call writefile(lines, input_file, "D")
295
296 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
297
298 call term_sendkeys(buf, "dic..")
299 let output_file = "comment_textobj_icomment.py"
300 call term_sendkeys(buf, $":w {output_file}\<CR>")
301 defer delete(output_file)
302
303 call StopVimInTerminal(buf)
304
305 let result = readfile(output_file)
306
307 call assert_equal(["for x in range(10):", " print(x) ", " print(x*x*x*x) ", " print(x*x*x*x*x) ", "", " print(x*x*x*x*x)"], result)
308endfunc
309
310func Test_textobj_icomment2()
311 CheckScreendump
312 let lines =<< trim END
313 #include <stdio.h>
314
315 int main() {
316 printf("hello"); /* hello world */ printf(" world\n");
317 /* if 1 {
318 return 1;
319 }*/
320
321 return 0;
322 }
323 END
324
325 let input_file = "test_textobj_icomment2_input.c"
326 call writefile(lines, input_file, "D")
327
328 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
329
330 call term_sendkeys(buf, "dic..")
331 let output_file = "comment_textobj_icomment2.c"
332 call term_sendkeys(buf, $":w {output_file}\<CR>")
333 defer delete(output_file)
334
335 call StopVimInTerminal(buf)
336
337 let result = readfile(output_file)
338
339 call assert_equal(["#include <stdio.h>", "", "int main() {", " printf(\"hello\"); printf(\" world\\n\");", " ", "", " return 0;", "}"], result)
340endfunc
341
342func Test_textobj_icomment3()
343 CheckScreendump
344 let lines =<< trim END
345 #include <stdio.h>
346
347 int main() {
348 printf("hello");/*hello world*/printf(" world\n");
349 return 0;
350 }
351 END
352
353 let input_file = "test_textobj_icomment3_input.c"
354 call writefile(lines, input_file, "D")
355
356 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
357
358 call term_sendkeys(buf, "jjjdic")
359 let output_file = "comment_textobj_icomment3.c"
360 call term_sendkeys(buf, $":w {output_file}\<CR>")
361 defer delete(output_file)
362
363 call StopVimInTerminal(buf)
364
365 let result = readfile(output_file)
366
367 call assert_equal(["#include <stdio.h>", "", "int main() {", " printf(\"hello\");printf(\" world\\n\");", " return 0;", "}"], result)
368endfunc
369
370func Test_textobj_acomment()
371 CheckScreendump
372 let lines =<< trim END
373 for x in range(10):
374 print(x) # printing stuff
375 # print(x*x)
376 #print(x*x*x)
377 print(x*x*x*x) # printing stuff
378 print(x*x*x*x*x) # printing stuff
379 # print(x*x)
380 #print(x*x*x)
381
382 print(x*x*x*x*x)
383 END
384
385 let input_file = "test_textobj_acomment_input.py"
386 call writefile(lines, input_file, "D")
387
388 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
389
390 call term_sendkeys(buf, "dac..")
391 let output_file = "comment_textobj_acomment.py"
392 call term_sendkeys(buf, $":w {output_file}\<CR>")
393 defer delete(output_file)
394
395 call StopVimInTerminal(buf)
396
397 let result = readfile(output_file)
398
399 call assert_equal(["for x in range(10):", " print(x)", " print(x*x*x*x)", " print(x*x*x*x*x)", "", " print(x*x*x*x*x)"], result)
400endfunc
401
402func Test_textobj_acomment2()
403 CheckScreendump
404 let lines =<< trim END
405 #include <stdio.h>
406
407 int main() {
408 printf("hello"); /* hello world */ printf(" world\n");
409 /* if 1 {
410 return 1;
411 }*/
412
413 return 0;
414 }
415 END
416
417 let input_file = "test_textobj_acomment2_input.c"
418 call writefile(lines, input_file, "D")
419
420 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
421
422 call term_sendkeys(buf, "dac.")
423 let output_file = "comment_textobj_acomment2.c"
424 call term_sendkeys(buf, $":w {output_file}\<CR>")
425 defer delete(output_file)
426
427 call StopVimInTerminal(buf)
428
429 let result = readfile(output_file)
430
431 call assert_equal(["#include <stdio.h>", "", "int main() {", " printf(\"hello\");printf(\" world\\n\");", " return 0;", "}"], result)
432endfunc
433
434func Test_textobj_acomment3()
435 CheckScreendump
436 let lines =<< trim END
437 #include <stdio.h>
438
439 int main() {
440 printf("hello");/*hello world*/printf(" world\n");
441 return 0;
442 }
443 END
444
445 let input_file = "test_textobj_acomment3_input.c"
446 call writefile(lines, input_file, "D")
447
448 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
449
450 call term_sendkeys(buf, "jjjdac")
451 let output_file = "comment_textobj_acomment3.c"
452 call term_sendkeys(buf, $":w {output_file}\<CR>")
453 defer delete(output_file)
454
455 call StopVimInTerminal(buf)
456
457 let result = readfile(output_file)
458
459 call assert_equal(["#include <stdio.h>", "", "int main() {", " printf(\"hello\");printf(\" world\\n\");", " return 0;", "}"], result)
460endfunc
461
462func Test_textobj_firstline_comment()
463 CheckScreendump
464 let lines =<< trim END
465 /*#include <stdio.h>*/
466
467 int main() {}
468 END
469
470 let input_file = "test_textobj_firstlinecomment_input.c"
471 call writefile(lines, input_file, "D")
472
473 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
474
475 call term_sendkeys(buf, "dac")
476 let output_file = "comment_textobj_firstline_comment.c"
477 call term_sendkeys(buf, $":w {output_file}\<CR>")
478 defer delete(output_file)
479
480 call StopVimInTerminal(buf)
481
482 let result = readfile(output_file)
483
484 call assert_equal(["int main() {}"], result)
485endfunc
486
487func Test_textobj_noleading_space_comment()
488 CheckScreendump
489 let lines =<< trim END
490 int main() {// main start
491 }/* main end */
492 END
493
494 let input_file = "test_textobj_noleading_space_input.c"
495 call writefile(lines, input_file, "D")
496
497 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
498
499 call term_sendkeys(buf, "dacdic")
500 let output_file = "comment_textobj_noleading_space_comment.c"
501 call term_sendkeys(buf, $":w {output_file}\<CR>")
502 defer delete(output_file)
503
504 call StopVimInTerminal(buf)
505
506 let result = readfile(output_file)
507
508 call assert_equal(["int main() {", "}"], result)
509endfunc
510
511func Test_textobj_noleading_space_comment2()
512 CheckScreendump
513 let lines =<< trim END
514 int main() {// main start
515 } /* main end */
516 END
517
518 let input_file = "test_textobj_noleading_space_input2.c"
519 call writefile(lines, input_file, "D")
520
521 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
522
523 call term_sendkeys(buf, "dac.")
524 let output_file = "comment_textobj_noleading_space_comment2.c"
525 call term_sendkeys(buf, $":w {output_file}\<CR>")
526 defer delete(output_file)
527
528 call StopVimInTerminal(buf)
529
530 let result = readfile(output_file)
531
532 call assert_equal(["int main() {", "}"], result)
533endfunc
534
Maxim Kima5807612025-03-30 14:55:26 +0200535func Test_textobj_trailing_spaces_comment()
536 CheckScreendump
537 let lines = ['# print("hello") ', '# print("world") ', "#", 'print("!")']
538
539 let input_file = "test_textobj_trailing_spaces_input.py"
540 call writefile(lines, input_file, "D")
541
542 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
543
544 call term_sendkeys(buf, "jdac")
545 let output_file = "comment_textobj_trailing_spaces_comment.py"
546 call term_sendkeys(buf, $":w {output_file}\<CR>")
547 defer delete(output_file)
548
549 call StopVimInTerminal(buf)
550
551 let result = readfile(output_file)
552
553 call assert_equal(['print("!")'], result)
554endfunc
555
556func Test_textobj_trailing_spaces_last_comment()
557 CheckScreendump
558 let lines = ['# print("hello") ', '# print("world") ', "#", '', '']
559
560 let input_file = "test_textobj_trailing_spaces_last_input.py"
561 call writefile(lines, input_file, "D")
562
563 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
564
565 call term_sendkeys(buf, "jdac")
566 let output_file = "comment_textobj_trailing_spaces_last_comment.py"
567 call term_sendkeys(buf, $":w {output_file}\<CR>")
568 defer delete(output_file)
569
570 call StopVimInTerminal(buf)
571
572 let result = readfile(output_file)
573
574 call assert_equal([], result)
575endfunc
576
577func Test_textobj_last_line_empty_comment()
578 CheckScreendump
579 let lines =<< trim END
580 # print("hello")
581 #
582 #
583 END
584
585 let input_file = "test_textobj_last_line_empty_input.py"
586 call writefile(lines, input_file, "D")
587
588 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
589
590 call term_sendkeys(buf, "dac")
591 let output_file = "comment_textobj_last_line_empty_comment.py"
592 call term_sendkeys(buf, $":w {output_file}\<CR>")
593 defer delete(output_file)
594
595 call StopVimInTerminal(buf)
596
597 let result = readfile(output_file)
598
599 call assert_equal([], result)
600endfunc
Maxim Kimdd776dd2025-04-22 20:11:05 +0200601
Maxim Kim9712a252025-03-21 18:02:56 +0100602func Test_textobj_cursor_on_leading_space_comment()
603 CheckScreendump
604 let lines =<< trim END
605 int main() {
606 // multilple comments
607 // cursor is between them
608 }
609 END
610
611 let input_file = "test_textobj_cursor_on_leading_space_comment_input.c"
612 call writefile(lines, input_file, "D")
613
614 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
615
616 call term_sendkeys(buf, "jjdac")
617 let output_file = "comment_textobj_cursor_on_leading_space_comment.c"
618 call term_sendkeys(buf, $":w {output_file}\<CR>")
619 defer delete(output_file)
620
621 call StopVimInTerminal(buf)
622
623 let result = readfile(output_file)
624
Maxim Kim08283b22025-03-26 19:04:20 +0100625 call assert_equal(["int main() {", "}"], result)
Maxim Kim9712a252025-03-21 18:02:56 +0100626endfunc
627
628func Test_textobj_conseq_comment()
629 CheckScreendump
630 let lines =<< trim END
631 int main() {
632 printf("hello"); // hello
633 // world
634 printf("world");
635 }
636 END
637
638 let input_file = "test_textobj_conseq_comment_input.c"
639 call writefile(lines, input_file, "D")
640
641 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
642
643 call term_sendkeys(buf, "dac")
644 let output_file = "comment_textobj_conseq_comment.c"
645 call term_sendkeys(buf, $":w {output_file}\<CR>")
646 defer delete(output_file)
647
648 call StopVimInTerminal(buf)
649
650 let result = readfile(output_file)
651
652 call assert_equal(["int main() {", " printf(\"hello\");", " printf(\"world\");", "}"], result)
653endfunc
654
655func Test_textobj_conseq_comment2()
656 CheckScreendump
657 let lines =<< trim END
658 int main() {
659 printf("hello"); // hello
660
661 // world
662 printf("world");
663 }
664 END
665
666 let input_file = "test_textobj_conseq_comment_input2.c"
667 call writefile(lines, input_file, "D")
668
669 let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
670
671 call term_sendkeys(buf, "dac")
672 let output_file = "comment_textobj_conseq_comment2.c"
673 call term_sendkeys(buf, $":w {output_file}\<CR>")
674 defer delete(output_file)
675
676 call StopVimInTerminal(buf)
677
678 let result = readfile(output_file)
679
680 call assert_equal(["int main() {", " printf(\"hello\");", "", " // world", " printf(\"world\");", "}"], result)
681endfunc
Maxim Kim08283b22025-03-26 19:04:20 +0100682
683func Test_inline_comment()
684 CheckScreendump
685 let lines =<< trim END
686 echo "Hello" This should be a comment
687 END
688
689 let input_file = "test_inline_comment_input.vim"
690 call writefile(lines, input_file, "D")
691
692 let buf = RunVimInTerminal('-c "packadd comment" -c "nnoremap <expr> gC comment#Toggle()..''$''" ' .. input_file, {})
693
694 call term_sendkeys(buf, "fTgC")
695
696 let output_file = "comment_inline_test.vim"
697 call term_sendkeys(buf, $":w {output_file}\<CR>")
698 defer delete(output_file)
699
700 call StopVimInTerminal(buf)
701
702 let result = readfile(output_file)
703 call assert_equal(['echo "Hello" " This should be a comment'], result)
704endfunc
705
706func Test_inline_uncomment()
707 CheckScreendump
708 let lines =<< trim END
709 echo "Hello" " This should be a comment
710 END
711
712 let input_file = "test_inline_uncomment_input.vim"
713 call writefile(lines, input_file, "D")
714
715 let buf = RunVimInTerminal('-c "packadd comment" -c "nnoremap <expr> gC comment#Toggle()..''$''" ' .. input_file, {})
716
717 call term_sendkeys(buf, '$F"gC')
718
719 let output_file = "uncomment_inline_test.vim"
720 call term_sendkeys(buf, $":w {output_file}\<CR>")
721 defer delete(output_file)
722
723 call StopVimInTerminal(buf)
724
725 let result = readfile(output_file)
726 call assert_equal(['echo "Hello" This should be a comment'], result)
727endfunc
Maxim Kim0e59e672025-04-12 11:34:08 +0200728
729func Test_textobj_selection_exclusive_inline_comment()
730 CheckScreendump
731 let lines =<< trim END
732 print("Hello") # selection exclusive
733 END
734
735 let input_file = "test_selection_exclusive_inline_comment_input.py"
736 call writefile(lines, input_file, "D")
737
738 let buf = RunVimInTerminal('-c "set selection=exclusive" -c "packadd comment" ' .. input_file, {})
739
740 call term_sendkeys(buf, "dac")
741
742 let output_file = "test_selection_exclusive_inline_comment.py"
743 call term_sendkeys(buf, $":w {output_file}\<CR>")
744 defer delete(output_file)
745
746 call StopVimInTerminal(buf)
747
748 let result = readfile(output_file)
749 call assert_equal(['print("Hello")'], result)
750endfunc