@@ -1265,7 +1265,7 @@ func CloseoffSetup()
12651265 call setline (1 , [' one' , ' tow' , ' three' ])
12661266 diffthis
12671267 call assert_equal (1 , &diff )
1268- only !
1268+ bw !
12691269endfunc
12701270
12711271func Test_diff_closeoff ()
@@ -2529,7 +2529,8 @@ func Test_diffget_diffput_linematch()
25292529 call term_sendkeys (buf , " 17gg" )
25302530 call term_sendkeys (buf , " :diffput\<CR> " )
25312531 call VerifyScreenDump (buf , ' Test_diff_get_put_linematch_19' , {})
2532-
2532+ " clean up
2533+ call StopVimInTerminal (buf )
25332534endfunc
25342535
25352536func Test_linematch_diff ()
@@ -2549,7 +2550,8 @@ func Test_linematch_diff()
25492550 \ ' abc d!' ,
25502551 \ ' d!' ])
25512552 call VerifyScreenDump (buf , ' Test_linematch_diff1' , {})
2552-
2553+ " clean up
2554+ call StopVimInTerminal (buf )
25532555endfunc
25542556
25552557func Test_linematch_diff_iwhite ()
@@ -2575,7 +2577,8 @@ func Test_linematch_diff_iwhite()
25752577 call VerifyScreenDump (buf , ' Test_linematch_diff_iwhite1' , {})
25762578 call term_sendkeys (buf , " :set diffopt+=iwhiteall\<CR> " )
25772579 call VerifyScreenDump (buf , ' Test_linematch_diff_iwhite2' , {})
2578-
2580+ " clean up
2581+ call StopVimInTerminal (buf )
25792582endfunc
25802583
25812584func Test_linematch_diff_grouping ()
@@ -2612,7 +2615,8 @@ func Test_linematch_diff_grouping()
26122615 \ ' ?C' ,
26132616 \ ' ?C' ])
26142617 call VerifyScreenDump (buf , ' Test_linematch_diff_grouping2' , {})
2615-
2618+ " clean up
2619+ call StopVimInTerminal (buf )
26162620endfunc
26172621
26182622func Test_linematch_diff_scroll ()
@@ -2643,11 +2647,10 @@ func Test_linematch_diff_scroll()
26432647 call VerifyScreenDump (buf , ' Test_linematch_diff_grouping_scroll1' , {})
26442648 call term_sendkeys (buf , " 3\<c-e> " )
26452649 call VerifyScreenDump (buf , ' Test_linematch_diff_grouping_scroll2' , {})
2646-
2650+ " clean up
2651+ call StopVimInTerminal (buf )
26472652endfunc
26482653
2649-
2650-
26512654func Test_linematch_line_limit_exceeded ()
26522655 CheckScreendump
26532656 call delete (' .Xdifile1.swp' )
@@ -2694,7 +2697,8 @@ func Test_linematch_line_limit_exceeded()
26942697 " alignment algorithm will run on the largest diff block here
26952698 call term_sendkeys (buf , " :set diffopt+=linematch:30\<CR> " )
26962699 call VerifyScreenDump (buf , ' Test_linematch_line_limit_exceeded2' , {})
2697-
2700+ " clean up
2701+ call StopVimInTerminal (buf )
26982702endfunc
26992703
27002704func Test_linematch_3diffs ()
@@ -2731,6 +2735,31 @@ func Test_linematch_3diffs()
27312735 \ " BBB" ,
27322736 \ " BBB" ])
27332737 call VerifyScreenDump (buf , ' Test_linematch_3diffs1' , {})
2738+ " clean up
2739+ call StopVimInTerminal (buf )
2740+ endfunc
27342741
2742+ " this used to access invalid memory
2743+ func Test_linematch_3diffs_sanity_check ()
2744+ CheckScreendump
2745+ call delete (' .Xfile_linematch1.swp' )
2746+ call delete (' .Xfile_linematch2.swp' )
2747+ call delete (' .Xfile_linematch3.swp' )
2748+ let lines = << trim END
2749+ set diffopt += linematch:60
2750+ call feedkeys (" Aq\<esc> " )
2751+ call feedkeys (" GAklm\<esc> " )
2752+ call feedkeys (" o" )
2753+ END
2754+ call writefile (lines , ' Xlinematch_3diffs.vim' , ' D' )
2755+ call writefile ([' abcd' , ' def' , ' hij' ], ' Xfile_linematch1' , ' D' )
2756+ call writefile ([' defq' , ' hijk' , ' nopq' ], ' Xfile_linematch2' , ' D' )
2757+ call writefile ([' hijklm' , ' nopqr' , ' stuv' ], ' Xfile_linematch3' , ' D' )
2758+ call WriteDiffFiles3 (0 , [], [], [])
2759+ let buf = RunVimInTerminal (' -d -S Xlinematch_3diffs.vim Xfile_linematch1 Xfile_linematch2 Xfile_linematch3' , {})
2760+ call VerifyScreenDump (buf , ' Test_linematch_3diffs2' , {})
2761+
2762+ " clean up
2763+ call StopVimInTerminal (buf )
27352764endfunc
27362765" vim: shiftwidth = 2 sts = 2 expandtab
0 commit comments