aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/diff_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui/diff_spec.lua')
-rw-r--r--test/functional/ui/diff_spec.lua607
1 files changed, 607 insertions, 0 deletions
diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua
index e79621f364..d6a04f90f6 100644
--- a/test/functional/ui/diff_spec.lua
+++ b/test/functional/ui/diff_spec.lua
@@ -12,6 +12,19 @@ local exec = n.exec
local eq = t.eq
local api = n.api
+local function WriteDiffFiles(text1, text2)
+ write_file('Xdifile1', text1)
+ write_file('Xdifile2', text2)
+ command('checktime')
+end
+
+local function WriteDiffFiles3(text1, text2, text3)
+ write_file('Xdifile1', text1)
+ write_file('Xdifile2', text2)
+ write_file('Xdifile3', text3)
+ command('checktime')
+end
+
before_each(clear)
describe('Diff mode screen', function()
@@ -614,6 +627,34 @@ int main(int argc, char **argv)
]])
end)
+ it('Diff empty and non-empty file', function()
+ write_file(fname, '', false)
+ write_file(fname_2, 'foo\nbar\nbaz', false)
+ reread()
+
+ feed(':set diffopt=filler<cr>')
+ screen:expect([[
+ {7: }{23:------------------}│{7: }{22:foo }|
+ {7: }{23:------------------}│{7: }{22:bar }|
+ {7: }{23:------------------}│{7: }{22:baz }|
+ {7: }^ │{1:~ }|
+ {1:~ }│{1:~ }|*10
+ {3:<onal-diff-screen-1 }{2:<l-diff-screen-1.2 }|
+ :set diffopt=filler |
+ ]])
+
+ feed(':set diffopt+=internal<cr>')
+ screen:expect([[
+ {7: }{23:------------------}│{7: }{22:foo }|
+ {7: }{23:------------------}│{7: }{22:bar }|
+ {7: }{23:------------------}│{7: }{22:baz }|
+ {7: }^ │{1:~ }|
+ {1:~ }│{1:~ }|*10
+ {3:<onal-diff-screen-1 }{2:<l-diff-screen-1.2 }|
+ :set diffopt+=internal |
+ ]])
+ end)
+
it('diffopt+=icase', function()
write_file(fname, 'a\nb\ncd\n', false)
write_file(fname_2, 'A\nb\ncDe\n', false)
@@ -1346,6 +1387,46 @@ it("diff mode doesn't restore invalid 'foldcolumn' value #21647", function()
eq('0', api.nvim_get_option_value('foldcolumn', {}))
end)
+it("'relativenumber' doesn't draw beyond end of window in diff mode #29403", function()
+ local screen = Screen.new(60, 12)
+ screen:attach()
+ command('set relativenumber')
+ feed('10aa<CR><Esc>gg')
+ command('vnew')
+ feed('ab<CR><Esc>gg')
+ command('windo diffthis')
+ command('wincmd |')
+ screen:expect([[
+ {8: }│{7: }{8: 0 }{27:^a}{4: }|
+ {8: }│{7: }{8: 1 }{22:a }|
+ {8: }│{7: }{8: 2 }{22:a }|
+ {8: }│{7: }{8: 3 }{22:a }|
+ {8: }│{7: }{8: 4 }{22:a }|
+ {8: }│{7: }{8: 5 }{22:a }|
+ {8: }│{7: }{8: 6 }{22:a }|
+ {8: }│{7: }{8: 7 }{22:a }|
+ {8: }│{7: }{8: 8 }{22:a }|
+ {8: }│{7: }{8: 9 }{22:a }|
+ {2:< }{3:[No Name] [+] }|
+ |
+ ]])
+ feed('j')
+ screen:expect([[
+ {8: }│{7: }{8: 1 }{27:a}{4: }|
+ {8: }│{7: }{8: 0 }{22:^a }|
+ {8: }│{7: }{8: 1 }{22:a }|
+ {8: }│{7: }{8: 2 }{22:a }|
+ {8: }│{7: }{8: 3 }{22:a }|
+ {8: }│{7: }{8: 4 }{22:a }|
+ {8: }│{7: }{8: 5 }{22:a }|
+ {8: }│{7: }{8: 6 }{22:a }|
+ {8: }│{7: }{8: 7 }{22:a }|
+ {8: }│{7: }{8: 8 }{22:a }|
+ {2:< }{3:[No Name] [+] }|
+ |
+ ]])
+end)
+
-- oldtest: Test_diff_binary()
it('diff mode works properly if file contains NUL bytes vim-patch:8.2.3925', function()
local screen = Screen.new(40, 20)
@@ -1447,3 +1528,529 @@ it("diff mode draws 'breakindent' correctly after filler lines", function()
|
]])
end)
+
+-- oldtest: Test_diff_overlapped_diff_blocks_will_be_merged()
+it('diff mode overlapped diff blocks will be merged', function()
+ write_file('Xdifile1', '')
+ write_file('Xdifile2', '')
+ write_file('Xdifile3', '')
+
+ finally(function()
+ os.remove('Xdifile1')
+ os.remove('Xdifile2')
+ os.remove('Xdifile3')
+ os.remove('Xdiin1')
+ os.remove('Xdinew1')
+ os.remove('Xdiout1')
+ os.remove('Xdiin2')
+ os.remove('Xdinew2')
+ os.remove('Xdiout2')
+ end)
+
+ exec([[
+ func DiffExprStub()
+ let txt_in = readfile(v:fname_in)
+ let txt_new = readfile(v:fname_new)
+ if txt_in == ["line1"] && txt_new == ["line2"]
+ call writefile(["1c1"], v:fname_out)
+ elseif txt_in == readfile("Xdiin1") && txt_new == readfile("Xdinew1")
+ call writefile(readfile("Xdiout1"), v:fname_out)
+ elseif txt_in == readfile("Xdiin2") && txt_new == readfile("Xdinew2")
+ call writefile(readfile("Xdiout2"), v:fname_out)
+ endif
+ endfunc
+ ]])
+
+ local screen = Screen.new(35, 20)
+ screen:attach()
+ command('set winwidth=10 diffopt=filler,internal')
+
+ command('args Xdifile1 Xdifile2 | vert all | windo diffthis')
+
+ WriteDiffFiles('a\nb', 'x\nx')
+ write_file('Xdiin1', 'a\nb')
+ write_file('Xdinew1', 'x\nx')
+ write_file('Xdiout1', '1c1\n2c2')
+ command('set diffexpr=DiffExprStub()')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:^x}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }|
+ {1:~ }│{1:~ }|*16
+ {2:Xdifile1 }{3:Xdifile2 }|
+ |
+ ]])
+ command('set diffexpr&')
+
+ WriteDiffFiles('a\nb\nc', 'x\nc')
+ write_file('Xdiin1', 'a\nb\nc')
+ write_file('Xdinew1', 'x\nc')
+ write_file('Xdiout1', '1c1\n2c1')
+ command('set diffexpr=DiffExprStub()')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:^x}{4: }|
+ {7: }{22:b }│{7: }{23:---------------}|
+ {7: }c │{7: }c |
+ {1:~ }│{1:~ }|*15
+ {2:Xdifile1 }{3:Xdifile2 }|
+ |
+ ]])
+ command('set diffexpr&')
+
+ WriteDiffFiles('a\nc', 'x\nx\nc')
+ write_file('Xdiin1', 'a\nc')
+ write_file('Xdinew1', 'x\nx\nc')
+ write_file('Xdiout1', '1c1\n1a2')
+ command('set diffexpr=DiffExprStub()')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:^x}{4: }|
+ {7: }{23:---------------}│{7: }{22:x }|
+ {7: }c │{7: }c |
+ {1:~ }│{1:~ }|*15
+ {2:Xdifile1 }{3:Xdifile2 }|
+ |
+ ]])
+ command('set diffexpr&')
+
+ command('args Xdifile1 Xdifile2 Xdifile3 | vert all | windo diffthis')
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', 'y\nb\nc')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:a}{4: }│{7: }{27:^y}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:b}{4: }|
+ {7: }c │{7: }c │{7: }c |
+ {1:~ }│{1:~ }│{1:~ }|*15
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', 'a\ny\nc')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }c │{7: }c │{7: }c |
+ {1:~ }│{1:~ }│{1:~ }|*15
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', 'a\nb\ny')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:b}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:y}{4: }|
+ {1:~ }│{1:~ }│{1:~ }|*15
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', 'y\ny\nc')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:a}{4: }│{7: }{27:^y}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }c │{7: }c │{7: }c |
+ {1:~ }│{1:~ }│{1:~ }|*15
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', 'a\ny\ny')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:y}{4: }|
+ {1:~ }│{1:~ }│{1:~ }|*15
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', 'y\ny\ny')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:a}{4: }│{7: }{27:^y}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:y}{4: }|
+ {1:~ }│{1:~ }│{1:~ }|*15
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nx', 'y\ny\nc')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:a}{4: }│{7: }{27:^y}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:x}{4: }│{7: }{27:c}{4: }|
+ {1:~ }│{1:~ }│{1:~ }|*15
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'x\nx\nc', 'a\ny\ny')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:x}{4: }│{7: }{27:^a}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:y}{4: }|
+ {1:~ }│{1:~ }│{1:~ }|*15
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'y\ny\ny\nd\ne')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:a}{4: }│{7: }{27:^y}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{27:d}{4: }|
+ {7: }e │{7: }e │{7: }e |
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'y\ny\ny\ny\ne')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:a}{4: }│{7: }{27:^y}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }e │{7: }e │{7: }e |
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'y\ny\ny\ny\ny')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:a}{4: }│{7: }{27:^y}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:e}{4: }│{7: }{27:e}{4: }│{7: }{27:y}{4: }|
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'a\ny\ny\nd\ne')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{27:d}{4: }|
+ {7: }e │{7: }e │{7: }e |
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'a\ny\ny\ny\ne')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }e │{7: }e │{7: }e |
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'a\ny\ny\ny\ny')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:e}{4: }│{7: }{27:e}{4: }│{7: }{27:y}{4: }|
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'a\nb\ny\nd\ne')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:b}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{27:d}{4: }|
+ {7: }e │{7: }e │{7: }e |
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'a\nb\ny\ny\ne')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:b}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }e │{7: }e │{7: }e |
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'a\nb\ny\ny\ny')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:b}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:e}{4: }│{7: }{27:e}{4: }│{7: }{27:y}{4: }|
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb', 'x\nb', 'y\ny')
+ write_file('Xdiin1', 'a\nb')
+ write_file('Xdinew1', 'x\nb')
+ write_file('Xdiout1', '1c1')
+ write_file('Xdiin2', 'a\nb')
+ write_file('Xdinew2', 'y\ny')
+ write_file('Xdiout2', '1c1\n2c2')
+ command('set diffexpr=DiffExprStub()')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:x}{4: }│{7: }{27:^y}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:b}{4: }│{7: }{27:y}{4: }|
+ {1:~ }│{1:~ }│{1:~ }|*16
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+ command('set diffexpr&')
+
+ WriteDiffFiles3('a\nb\nc\nd', 'x\nb\nx\nd', 'y\ny\nc\nd')
+ write_file('Xdiin1', 'a\nb\nc\nd')
+ write_file('Xdinew1', 'x\nb\nx\nd')
+ write_file('Xdiout1', '1c1\n3c3')
+ write_file('Xdiin2', 'a\nb\nc\nd')
+ write_file('Xdinew2', 'y\ny\nc\nd')
+ write_file('Xdiout2', '1c1\n2c2')
+ command('set diffexpr=DiffExprStub()')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:x}{4: }│{7: }{27:^y}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:b}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:x}{4: }│{7: }{27:c}{4: }|
+ {7: }d │{7: }d │{7: }d |
+ {1:~ }│{1:~ }│{1:~ }|*14
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+ command('set diffexpr&')
+
+ WriteDiffFiles3('a\nb\nc\nd', 'x\nb\nx\nd', 'y\ny\ny\nd')
+ write_file('Xdiin1', 'a\nb\nc\nd')
+ write_file('Xdinew1', 'x\nb\nx\nd')
+ write_file('Xdiout1', '1c1\n3c3')
+ write_file('Xdiin2', 'a\nb\nc\nd')
+ write_file('Xdinew2', 'y\ny\ny\nd')
+ write_file('Xdiout2', '1c1\n2,3c2,3')
+ command('set diffexpr=DiffExprStub()')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:x}{4: }│{7: }{27:^y}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:b}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }d │{7: }d │{7: }d |
+ {1:~ }│{1:~ }│{1:~ }|*14
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+ command('set diffexpr&')
+
+ WriteDiffFiles3('a\nb\nc\nd', 'x\nb\nx\nd', 'y\ny\ny\ny')
+ write_file('Xdiin1', 'a\nb\nc\nd')
+ write_file('Xdinew1', 'x\nb\nx\nd')
+ write_file('Xdiout1', '1c1\n3c3')
+ write_file('Xdiin2', 'a\nb\nc\nd')
+ write_file('Xdinew2', 'y\ny\ny\ny')
+ write_file('Xdiout2', '1c1\n2,4c2,4')
+ command('set diffexpr=DiffExprStub()')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:x}{4: }│{7: }{27:^y}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:b}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{27:d}{4: }│{7: }{27:d}{4: }│{7: }{27:y}{4: }|
+ {1:~ }│{1:~ }│{1:~ }|*14
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+ command('set diffexpr&')
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', 'b\nc')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:a}{4: }│{7: }{27:^b}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }c │{7: }c │{7: }c |
+ {1:~ }│{1:~ }│{1:~ }|*15
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', 'c')
+ screen:expect([[
+ {7: }{4:a }│{7: }{4:a }│{7: }{23:---------}|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }c │{7: }c │{7: }^c |
+ {1:~ }│{1:~ }│{1:~ }|*15
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', '')
+ screen:expect([[
+ {7: }{4:a }│{7: }{4:a }│{7: }{23:---------}|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }{4:c }│{7: }{4:c }│{7: }{23:---------}|
+ {1:~ }│{1:~ }│{7: }^ |
+ {1:~ }│{1:~ }│{1:~ }|*14
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', 'a\nc')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }c │{7: }c │{7: }c |
+ {1:~ }│{1:~ }│{1:~ }|*15
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', 'a')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }{4:c }│{7: }{4:c }│{7: }{23:---------}|
+ {1:~ }│{1:~ }│{1:~ }|*15
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', 'b')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:a}{4: }│{7: }{27:^b}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }{4:c }│{7: }{4:c }│{7: }{23:---------}|
+ {1:~ }│{1:~ }│{1:~ }|*15
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'd\ne')
+ screen:expect([[
+ {7: }{27:a}{4: }│{7: }{27:a}{4: }│{7: }{27:^d}{4: }|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }{4:c }│{7: }{4:c }│{7: }{23:---------}|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }e │{7: }e │{7: }e |
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'e')
+ screen:expect([[
+ {7: }{4:a }│{7: }{4:a }│{7: }{23:---------}|
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }{4:c }│{7: }{4:c }│{7: }{23:---------}|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }e │{7: }e │{7: }^e |
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'a\nd\ne')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:d}{4: }|
+ {7: }{4:c }│{7: }{4:c }│{7: }{23:---------}|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }e │{7: }e │{7: }e |
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'a\ne')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }{4:c }│{7: }{4:c }│{7: }{23:---------}|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }e │{7: }e │{7: }e |
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'a')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }{4:c }│{7: }{4:c }│{7: }{23:---------}|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }{4:e }│{7: }{4:e }│{7: }{23:---------}|
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'a\nb\nd\ne')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:b}{4: }|
+ {7: }{27:c}{4: }│{7: }{27:c}{4: }│{7: }{27:d}{4: }|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }e │{7: }e │{7: }e |
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'a\nb\ne')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:b}{4: }|
+ {7: }{4:c }│{7: }{4:c }│{7: }{23:---------}|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }e │{7: }e │{7: }e |
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc\nd\ne', 'a\nx\nc\nx\ne', 'a\nb')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:b}{4: }|
+ {7: }{4:c }│{7: }{4:c }│{7: }{23:---------}|
+ {7: }{27:d}{4: }│{7: }{27:x}{4: }│{7: }{23:---------}|
+ {7: }{4:e }│{7: }{4:e }│{7: }{23:---------}|
+ {1:~ }│{1:~ }│{1:~ }|*13
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', 'a\ny\nb\nc')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:y}{4: }|
+ {7: }{23:---------}│{7: }{23:---------}│{7: }{22:b }|
+ {7: }c │{7: }c │{7: }c |
+ {1:~ }│{1:~ }│{1:~ }|*14
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+
+ WriteDiffFiles3('a\nb\nc', 'a\nx\nc', 'a\nb\ny\nc')
+ screen:expect([[
+ {7: }a │{7: }a │{7: }^a |
+ {7: }{27:b}{4: }│{7: }{27:x}{4: }│{7: }{27:b}{4: }|
+ {7: }{23:---------}│{7: }{23:---------}│{7: }{22:y }|
+ {7: }c │{7: }c │{7: }c |
+ {1:~ }│{1:~ }│{1:~ }|*14
+ {2:Xdifile1 Xdifile2 }{3:Xdifile3 }|
+ |
+ ]])
+end)