From cf1ffa91667a482c6355f5999b9e97ccc0b4126a Mon Sep 17 00:00:00 2001 From: Anatolii Sakhnik Date: Sun, 2 Dec 2018 22:58:07 +0200 Subject: vim-patch:8.1.0360: using an external diff program is slow and inflexible Problem: Using an external diff program is slow and inflexible. Solution: Include the xdiff library. (Christian Brabandt) Use it by default. https://github.com/vim/vim/commit/e828b7621cf9065a3582be0c4dd1e0e846e335bf vim-patch:8.1.0360 vim-patch:8.1.0364 vim-patch:8.1.0366 vim-patch:8.1.0370 vim-patch:8.1.0377 vim-patch:8.1.0378 vim-patch:8.1.0381 vim-patch:8.1.0396 vim-patch:8.1.0432 --- test/functional/ui/diff_spec.lua | 776 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 776 insertions(+) create mode 100644 test/functional/ui/diff_spec.lua (limited to 'test/functional/ui') diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua new file mode 100644 index 0000000000..8f2b667b3c --- /dev/null +++ b/test/functional/ui/diff_spec.lua @@ -0,0 +1,776 @@ +local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') + +local feed = helpers.feed +local clear = helpers.clear +local write_file = helpers.write_file + +describe('Diff mode screen', function() + local fname = 'Xtest-functional-diff-screen-1' + local fname_2 = fname .. '.2' + local screen + + local reread = function() + feed(':ew:ew') + end + + setup(function() + clear() + os.remove(fname) + os.remove(fname_2) + end) + + teardown(function() + os.remove(fname) + os.remove(fname_2) + end) + + before_each(function() + clear() + feed(':e ' .. fname_2 .. '') + feed(':vnew ' .. fname .. '') + feed(':diffthis') + feed('w:diffthisw') + + screen = Screen.new(40, 16) + screen:attach() + screen:set_default_attr_ids({ + [1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray}, + [2] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1}, + [3] = {reverse = true}, + [4] = {background = Screen.colors.LightBlue}, + [5] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey}, + [6] = {bold = true, foreground = Screen.colors.Blue1}, + [7] = {bold = true, reverse = true}, + [8] = {bold = true, background = Screen.colors.Red}, + [9] = {background = Screen.colors.LightMagenta}, + }) + end) + + it('Add a line in beginning of file 2', function() + write_file(fname, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false) + write_file(fname_2, "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false) + reread() + + feed(':set diffopt=filler') + screen:expect([[ + {1: }{2:------------------}{3:│}{1: }{4:0 }| + {1: }^1 {3:│}{1: }1 | + {1: }2 {3:│}{1: }2 | + {1: }3 {3:│}{1: }3 | + {1: }4 {3:│}{1: }4 | + {1: }5 {3:│}{1: }5 | + {1: }6 {3:│}{1: }6 | + {1:+ }{5:+-- 4 lines: 7···}{3:│}{1:+ }{5:+-- 4 lines: 7··}| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + screen:expect([[ + {1: }{2:------------------}{3:│}{1: }{4:0 }| + {1: }^1 {3:│}{1: }1 | + {1: }2 {3:│}{1: }2 | + {1: }3 {3:│}{1: }3 | + {1: }4 {3:│}{1: }4 | + {1: }5 {3:│}{1: }5 | + {1: }6 {3:│}{1: }6 | + {1:+ }{5:+-- 4 lines: 7···}{3:│}{1:+ }{5:+-- 4 lines: 7··}| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:") + screen:expect([[ + {1: }{4:^0 }{3:│}{1: }{2:-----------------}| + {1: }1 {3:│}{1: }1 | + {1: }2 {3:│}{1: }2 | + {1: }3 {3:│}{1: }3 | + {1: }4 {3:│}{1: }4 | + {1: }5 {3:│}{1: }5 | + {1: }6 {3:│}{1: }6 | + {1:+ }{5:+-- 4 lines: 7···}{3:│}{1:+ }{5:+-- 4 lines: 7··}| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:") + screen:expect([[ + {1: }{4:^0 }{3:│}{1: }{2:-----------------}| + {1: }1 {3:│}{1: }1 | + {1: }2 {3:│}{1: }2 | + {1: }3 {3:│}{1: }3 | + {1: }4 {3:│}{1: }4 | + {1: }5 {3:│}{1: }5 | + {1: }6 {3:│}{1: }6 | + {1:+ }{5:+-- 4 lines: 7···}{3:│}{1:+ }{5:+-- 4 lines: 7··}| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:") + screen:expect([[ + {1:+ }{5:^+-- 4 lines: 1···}{3:│}{1:+ }{5:+-- 4 lines: 1··}| + {1: }5 {3:│}{1: }5 | + {1: }6 {3:│}{1: }6 | + {1: }7 {3:│}{1: }7 | + {1: }8 {3:│}{1: }8 | + {1: }9 {3:│}{1: }9 | + {1: }10 {3:│}{1: }10 | + {1: }{2:------------------}{3:│}{1: }{4:11 }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:") + screen:expect([[ + {1:+ }{5:^+-- 4 lines: 1···}{3:│}{1:+ }{5:+-- 4 lines: 1··}| + {1: }5 {3:│}{1: }5 | + {1: }6 {3:│}{1: }6 | + {1: }7 {3:│}{1: }7 | + {1: }8 {3:│}{1: }8 | + {1: }9 {3:│}{1: }9 | + {1: }10 {3:│}{1: }10 | + {1: }{2:------------------}{3:│}{1: }{4:11 }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:") + screen:expect([[ + {1:+ }{5:^+-- 4 lines: 1···}{3:│}{1:+ }{5:+-- 4 lines: 1··}| + {1: }5 {3:│}{1: }5 | + {1: }6 {3:│}{1: }6 | + {1: }7 {3:│}{1: }7 | + {1: }8 {3:│}{1: }8 | + {1: }9 {3:│}{1: }9 | + {1: }10 {3:│}{1: }10 | + {1: }{4:11 }{3:│}{1: }{2:-----------------}| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:") + screen:expect([[ + {1:+ }{5:^+-- 4 lines: 1···}{3:│}{1:+ }{5:+-- 4 lines: 1··}| + {1: }5 {3:│}{1: }5 | + {1: }6 {3:│}{1: }6 | + {1: }7 {3:│}{1: }7 | + {1: }8 {3:│}{1: }8 | + {1: }9 {3:│}{1: }9 | + {1: }10 {3:│}{1: }10 | + {1: }{4:11 }{3:│}{1: }{2:-----------------}| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + screen:expect([[ + {1: }^1 {3:│}{1: }1 | + {1: }2 {3:│}{1: }2 | + {1: }3 {3:│}{1: }3 | + {1: }4 {3:│}{1: }4 | + {1: }{2:------------------}{3:│}{1: }{4:4 }| + {1: }5 {3:│}{1: }5 | + {1: }6 {3:│}{1: }6 | + {1: }7 {3:│}{1: }7 | + {1: }8 {3:│}{1: }8 | + {1: }9 {3:│}{1: }9 | + {1: }10 {3:│}{1: }10 | + {1: }{4:11 }{3:│}{1: }{2:-----------------}| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + screen:expect([[ + {1: }^1 {3:│}{1: }1 | + {1: }2 {3:│}{1: }2 | + {1: }3 {3:│}{1: }3 | + {1: }4 {3:│}{1: }4 | + {1: }{2:------------------}{3:│}{1: }{4:4 }| + {1: }5 {3:│}{1: }5 | + {1: }6 {3:│}{1: }6 | + {1: }7 {3:│}{1: }7 | + {1: }8 {3:│}{1: }8 | + {1: }9 {3:│}{1: }9 | + {1: }10 {3:│}{1: }10 | + {1: }{4:11 }{3:│}{1: }{2:-----------------}| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + screen:expect([[ + {1: }^1 {3:│}{1: }1 | + {1: }2 {3:│}{1: }2 | + {1: }3 {3:│}{1: }3 | + {1: }4 {3:│}{1: }4 | + {1: }{4:4 }{3:│}{1: }{2:-----------------}| + {1: }5 {3:│}{1: }5 | + {1: }6 {3:│}{1: }6 | + {1: }7 {3:│}{1: }7 | + {1: }8 {3:│}{1: }8 | + {1: }9 {3:│}{1: }9 | + {1: }10 {3:│}{1: }10 | + {1: }{2:------------------}{3:│}{1: }{4:11 }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + screen:expect([[ + {1: }^1 {3:│}{1: }1 | + {1: }2 {3:│}{1: }2 | + {1: }3 {3:│}{1: }3 | + {1: }4 {3:│}{1: }4 | + {1: }{4:4 }{3:│}{1: }{2:-----------------}| + {1: }5 {3:│}{1: }5 | + {1: }6 {3:│}{1: }6 | + {1: }7 {3:│}{1: }7 | + {1: }8 {3:│}{1: }8 | + {1: }9 {3:│}{1: }9 | + {1: }10 {3:│}{1: }10 | + {1: }{2:------------------}{3:│}{1: }{4:11 }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7: + +// Frobs foo heartily +int frobnitz(int foo) +{ + int i; + for(i = 0; i < 10; i++) + { + printf("Your answer is: "); + printf("%d\n", foo); + } +} + +int fact(int n) +{ + if(n > 1) + { + return fact(n-1) * n; + } + return 1; +} + +int main(int argc, char **argv) +{ + frobnitz(fact(10)); +}]] + write_file(fname, f1, false) + local f2 = [[#include + +int fib(int n) +{ + if(n > 2) + { + return fib(n-1) + fib(n-2); + } + return 1; +} + +// Frobs foo heartily +int frobnitz(int foo) +{ + int i; + for(i = 0; i < 10; i++) + { + printf("%d\n", foo); + } +} + +int main(int argc, char **argv) +{ + frobnitz(fib(10)); +}]] + write_file(fname_2, f2, false) + end) + + it('diffopt=+algorithm:myers', function() + reread() + feed(':set diffopt=internal,filler') + screen:expect([[ + {1: }^#include {3:│}{1: }#include 2)}{9: }| + {1: }{4: for(i = 0; i <}{3:│}{1: }{2:-----------------}| + {1: } { {3:│}{1: } { | + {1: }{9: }{8:printf("Yo}{3:│}{1: }{9: }{8:return fi}| + {1: }{4: printf("%d}{3:│}{1: }{2:-----------------}| + {1: } } {3:│}{1: } } | + {1: }{2:------------------}{3:│}{1: }{4: return 1; }| + {1: }} {3:│}{1: }} | + {1: } {3:│}{1: } | + {7: 1)}{9: }{3:│}{1: }{9: i}{8:nt i;}{9: }| + {1: }{2:------------------}{3:│}{1: }{4: for(i = 0; i }| + {1: } { {3:│}{1: } { | + {1: }{9: }{8:return fac}{3:│}{1: }{9: }{8:printf("%}| + {1: } } {3:│}{1: } } | + {1: }{4: return 1; }{3:│}{1: }{2:-----------------}| + {1: }} {3:│}{1: }} | + {1: } {3:│}{1: } | + {1: }int main(int argc,{3:│}{1: }int main(int argc| + {1: }{ {3:│}{1: }{ | + {1: }{9: frobnitz(f}{8:act}{9:(}{3:│}{1: }{9: frobnitz(f}{8:ib}{9:(}| + {1: }^} {3:│}{1: }} | + {7:') + screen:expect([[ + {1: }^#include {3:│}{1: }#include 2) }| + {1: }{2:------------------}{3:│}{1: }{4: { }| + {1: }{2:------------------}{3:│}{1: }{4: return fi}| + {1: }{2:------------------}{3:│}{1: }{4: } }| + {1: }{2:------------------}{3:│}{1: }{4: return 1; }| + {1: }{2:------------------}{3:│}{1: }{4:} }| + {1: }{2:------------------}{3:│}{1: }{4: }| + {1: }// Frobs foo heart{3:│}{1: }// Frobs foo hear| + {1: }int frobnitz(int f{3:│}{1: }int frobnitz(int | + {1: }{ {3:│}{1: }{ | + {7: 1) }{3:│}{1: }{2:-----------------}| + {1: }{4: { }{3:│}{1: }{2:-----------------}| + {1: }{4: return fac}{3:│}{1: }{2:-----------------}| + {1: }{4: } }{3:│}{1: }{2:-----------------}| + {1: }{4: return 1; }{3:│}{1: }{2:-----------------}| + {1: }{4:} }{3:│}{1: }{2:-----------------}| + {1: }{4: }{3:│}{1: }{2:-----------------}| + {1: }int main(int argc,{3:│}{1: }int main(int argc| + {1: }{ {3:│}{1: }{ | + {1: }{9: frobnitz(f}{8:act}{9:(}{3:│}{1: }{9: frobnitz(f}{8:ib}{9:(}| + {1: }^} {3:│}{1: }} | + {7:') + screen:expect([[ + {1: }^#include {3:│}{1: }#include 2) }| + {1: }{2:------------------}{3:│}{1: }{4: { }| + {1: }{2:------------------}{3:│}{1: }{4: return fi}| + {1: }{2:------------------}{3:│}{1: }{4: } }| + {1: }{2:------------------}{3:│}{1: }{4: return 1; }| + {1: }{2:------------------}{3:│}{1: }{4:} }| + {1: }{2:------------------}{3:│}{1: }{4: }| + {1: }// Frobs foo heart{3:│}{1: }// Frobs foo hear| + {1: }int frobnitz(int f{3:│}{1: }int frobnitz(int | + {1: }{ {3:│}{1: }{ | + {7: 1) }{3:│}{1: }{2:-----------------}| + {1: }{4: { }{3:│}{1: }{2:-----------------}| + {1: }{4: return fac}{3:│}{1: }{2:-----------------}| + {1: }{4: } }{3:│}{1: }{2:-----------------}| + {1: }{4: return 1; }{3:│}{1: }{2:-----------------}| + {1: }{4:} }{3:│}{1: }{2:-----------------}| + {1: }{4: }{3:│}{1: }{2:-----------------}| + {1: }int main(int argc,{3:│}{1: }int main(int argc| + {1: }{ {3:│}{1: }{ | + {1: }{9: frobnitz(f}{8:act}{9:(}{3:│}{1: }{9: frobnitz(f}{8:ib}{9:(}| + {1: }^} {3:│}{1: }} | + {7:') + end) + + it('internal', function() + reread() + feed(":set diffopt=internal,filler") + screen:expect([[ + {1: }^def finalize(value{3:│}{1: }def finalize(valu| + {1: } {3:│}{1: } | + {1: } values.each do |{3:│}{1: } values.each do | + {1: }{2:------------------}{3:│}{1: }{4: v.prepare }| + {1: }{2:------------------}{3:│}{1: }{4: end }| + {1: }{2:------------------}{3:│}{1: }{4: }| + {1: }{2:------------------}{3:│}{1: }{4: values.each do }| + {1: } v.finalize {3:│}{1: } v.finalize | + {1: } end {3:│}{1: } end | + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + screen:expect([[ + {1: }^def finalize(value{3:│}{1: }def finalize(valu| + {1: } {3:│}{1: } | + {1: }{2:------------------}{3:│}{1: }{4: values.each do }| + {1: }{2:------------------}{3:│}{1: }{4: v.prepare }| + {1: }{2:------------------}{3:│}{1: }{4: end }| + {1: }{2:------------------}{3:│}{1: }{4: }| + {1: } values.each do |{3:│}{1: } values.each do | + {1: } v.finalize {3:│}{1: } v.finalize | + {1: } end {3:│}{1: } end | + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + screen:expect([[ + {1:+ }{5:^+-- 10 lines: 1···}{3:│}{1:+ }{5:+-- 10 lines: 1··}| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + screen:expect([[ + {1:+ }{5:^+-- 10 lines: 1···}{3:│}{1:+ }{5:+-- 10 lines: 1··}| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + screen:expect([[ + {1:- }^ {3:│}{1:- } | + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + screen:expect([[ + {1:- }^ {3:│}{1:- } | + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + screen:expect([[ + {1: }^a {3:│}{1: }A | + {1: }b {3:│}{1: }b | + {1: }{9:cd }{3:│}{1: }{9:cD}{8:e}{9: }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + screen:expect([[ + {1: }^a {3:│}{1: }A | + {1: }b {3:│}{1: }b | + {1: }{9:cd }{3:│}{1: }{9:cD}{8:e}{9: }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + end) + + it('external', function() + reread() + feed(':set diffopt=filler,iwhite') + screen:expect([[ + {1: }^int main() {3:│}{1: }int main() | + {1: }{ {3:│}{1: }{ | + {1: }{2:------------------}{3:│}{1: }{4: if (0) }| + {1: }{2:------------------}{3:│}{1: }{4: { }| + {1: } printf("Hello, {3:│}{1: } printf("Hel| + {1: } return 0; {3:│}{1: } return 0; | + {1: }{2:------------------}{3:│}{1: }{4: } }| + {1: }} {3:│}{1: }} | + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + screen:expect([[ + {1: }^int main() {3:│}{1: }int main() | + {1: }{ {3:│}{1: }{ | + {1: }{2:------------------}{3:│}{1: }{4: if (0) }| + {1: }{2:------------------}{3:│}{1: }{4: { }| + {1: } printf("Hello, {3:│}{1: } printf("Hel| + {1: } return 0; {3:│}{1: } return 0; | + {1: }{2:------------------}{3:│}{1: }{4: } }| + {1: }} {3:│}{1: }} | + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7: Date: Sun, 9 Dec 2018 15:00:19 +0200 Subject: vim-patch:8.1.0393: not all white space difference options available Problem: Not all white space difference options available. Solution: Add "iblank", "iwhiteall" and "iwhiteeol" to 'diffopt'. https://github.com/vim/vim/commit/785fc6567f572b8caefbc89ec29bbd8b801464ae --- test/functional/ui/diff_spec.lua | 159 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) (limited to 'test/functional/ui') diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index 8f2b667b3c..4d81d85553 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -773,4 +773,163 @@ int main(int argc, char **argv) ]]) end) end) + + describe('diffopt+=iblank', function() + setup(function() + write_file(fname, 'a\n\n \ncd\nef\nxxx\n', false) + write_file(fname_2, 'a\ncd\n\nef\nyyy\n', false) + feed(':diffupdate!') + end) + + it('generic', function() + reread() + feed(':set diffopt=internal,filler,iblank') + screen:expect([[ + {1: }^a {3:│}{1: }a | + {1: }{4: }{3:│}{1: }{2:-----------------}| + {1: }{4: }{3:│}{1: }{2:-----------------}| + {1: }cd {3:│}{1: }cd | + {1: }ef {3:│}{1: } | + {1: }{8:xxx}{9: }{3:│}{1: }ef | + {1: }{6:~ }{3:│}{1: }{8:yyy}{9: }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + feed(':') + screen:expect([[ + {1: }^a {3:│}{1: }a | + {1: } {3:│}{1: }cd | + {1: } {3:│}{1: } | + {1: }cd {3:│}{1: }ef | + {1: }ef {3:│}{1: }{8:yyy}{9: }| + {1: }{8:xxx}{9: }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + feed(':') + screen:expect([[ + {1: }^a {3:│}{1: }a | + {1: } {3:│}{1: }cd | + {1: } {3:│}{1: } | + {1: }cd {3:│}{1: }ef | + {1: }ef {3:│}{1: }{8:yyy}{9: }| + {1: }{8:xxx}{9: }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + feed(':') + screen:expect([[ + {1: }^a {3:│}{1: }a | + {1: } {3:│}{1: }cd | + {1: } {3:│}{1: } | + {1: }cd {3:│}{1: }ef | + {1: }ef {3:│}{1: }{8:yyy}{9: }| + {1: }{8:xxx}{9: }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + end) + + it('diffopt+=iwhiteeol', function() + reread() + feed(':set diffopt=internal,filler,iwhiteeol') + feed(':') + screen:expect([[ + {1: }^a {3:│}{1: }a | + {1: }x {3:│}{1: }x | + {1: }{9:cd }{3:│}{1: }{9:c}{8: }{9:d }| + {1: }{9:ef }{3:│}{1: }{8: }{9:ef }| + {1: }{9:xx }{8: }{9:xx }{3:│}{1: }{9:xx xx }| + {1: }foo {3:│}{1: }foo | + {1: }{2:------------------}{3:│}{1: }{4: }| + {1: }bar {3:│}{1: }bar | + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7:') + feed(':') + screen:expect([[ + {1: }^a {3:│}{1: }a | + {1: }x {3:│}{1: }x | + {1: }cd {3:│}{1: }c d | + {1: }ef {3:│}{1: } ef | + {1: }xx xx {3:│}{1: }xx xx | + {1: }foo {3:│}{1: }foo | + {1: }{2:------------------}{3:│}{1: }{4: }| + {1: }bar {3:│}{1: }bar | + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7: Date: Sun, 9 Dec 2018 20:24:38 +0200 Subject: vim-patch:8.1.0562: parsing of 'diffopt' is slightly wrong Problem: Parsing of 'diffopt' is slightly wrong. Solution: Fix the parsing and add a test. (Jason Franklin, Christian Brabandt) https://github.com/vim/vim/commit/b6fc72851c45a36a370f9516c68508e47b41c4c1 --- test/functional/ui/diff_spec.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/functional/ui') diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index 4d81d85553..8e6756e550 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -578,6 +578,30 @@ int main(int argc, char **argv) | ]]) end) + + it('indent-heuristic random order', function() + reread() + feed(':set diffopt=internal,filler,indent-heuristic,algorithm:patience') + feed(':') + screen:expect([[ + {1: }^def finalize(value{3:│}{1: }def finalize(valu| + {1: } {3:│}{1: } | + {1: }{2:------------------}{3:│}{1: }{4: values.each do }| + {1: }{2:------------------}{3:│}{1: }{4: v.prepare }| + {1: }{2:------------------}{3:│}{1: }{4: end }| + {1: }{2:------------------}{3:│}{1: }{4: }| + {1: } values.each do |{3:│}{1: } values.each do | + {1: } v.finalize {3:│}{1: } v.finalize | + {1: } end {3:│}{1: } end | + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {1: }{6:~ }{3:│}{1: }{6:~ }| + {7: