diff options
author | Jonathon <32371757+jwhite510@users.noreply.github.com> | 2022-11-04 05:07:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-04 09:07:22 +0000 |
commit | 04fbb1de4488852c3ba332898b17180500f8984e (patch) | |
tree | 3ea70069a8c2644f439f5d8ac346ec07a775741b /test/functional/ui/diff_spec.lua | |
parent | cc5b7368d61cfcd775dd02803dbdb8d4d05b5d5d (diff) | |
download | rneovim-04fbb1de4488852c3ba332898b17180500f8984e.tar.gz rneovim-04fbb1de4488852c3ba332898b17180500f8984e.tar.bz2 rneovim-04fbb1de4488852c3ba332898b17180500f8984e.zip |
Enable new diff option linematch (#14537)
Co-authored-by: Lewis Russell <me@lewisr.dev>
Diffstat (limited to 'test/functional/ui/diff_spec.lua')
-rw-r--r-- | test/functional/ui/diff_spec.lua | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index 36dc5addcd..dd35f47ca1 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -1073,6 +1073,182 @@ int main(int argc, char **argv) :e | ]]) end) + + describe('line matching diff algorithm', function() + setup(function() + local f1 = [[if __name__ == "__main__": + import sys + app = QWidgets.QApplication(sys.args) + MainWindow = QtWidgets.QMainWindow() + ui = UI_MainWindow() + ui.setupUI(MainWindow) + MainWindow.show() + sys.exit(app.exec_())]] + write_file(fname, f1, false) + local f2 = [[if __name__ == "__main__": + import sys + comment these things + #app = QWidgets.QApplication(sys.args) + #MainWindow = QtWidgets.QMainWindow() + add a completely different line here + #ui = UI_MainWindow() + add another new line + ui.setupUI(MainWindow) + MainWindow.show() + sys.exit(app.exec_())]] + write_file(fname_2, f2, false) + end) + + it('diffopt+=linematch:20', function() + reread() + feed(':set diffopt=internal,filler<cr>') + screen:expect([[ + {1: }^if __name__ == "__│{1: }if __name__ == "_| + {1: } import sys │{1: } import sys | + {1: }{9: }{8:app = QWidgets}│{1: }{9: }{8:comment these}| + {1: }{9: }{8:MainWindow = Q}│{1: }{9: }{8:#app = QWidge}| + {1: }{9: }{8:ui = UI_}{9:MainWi}│{1: }{9: }{8:#MainWindow =}| + {1: }{2:------------------}│{1: }{4: add a complet}| + {1: }{2:------------------}│{1: }{4: #ui = UI_Main}| + {1: }{2:------------------}│{1: }{4: add another n}| + {1: } ui.setupUI(Mai│{1: } ui.setupUI(Ma| + {1: } MainWindow.sho│{1: } MainWindow.sh| + {1: } sys.exit(app.e│{1: } sys.exit(app.| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }| + :set diffopt=internal,filler | + ]]) + + feed('G') + feed(':set diffopt+=linematch:20<cr>') + screen:expect([[ + {1: }if __name__ == "__│{1: }if __name__ == "_| + {1: } import sys │{1: } import sys | + {1: }{2:------------------}│{1: }{4: comment these}| + {1: }{9: app = QWidgets}│{1: }{9: }{8:#}{9:app = QWidge}| + {1: }{9: MainWindow = Q}│{1: }{9: }{8:#}{9:MainWindow =}| + {1: }{2:------------------}│{1: }{4: add a complet}| + {1: }{9: ui = UI_MainWi}│{1: }{9: }{8:#}{9:ui = UI_Main}| + {1: }{2:------------------}│{1: }{4: add another n}| + {1: } ui.setupUI(Mai│{1: } ui.setupUI(Ma| + {1: } MainWindow.sho│{1: } MainWindow.sh| + {1: } ^sys.exit(app.e│{1: } sys.exit(app.| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }| + :set diffopt+=linematch:20 | + ]]) + end) + end) + + describe('line matching diff algorithm with icase', function() + setup(function() + local f1 = [[DDD +_aa]] + write_file(fname, f1, false) + local f2 = [[DDD +AAA +ccca]] + write_file(fname_2, f2, false) + end) + it('diffopt+=linematch:20,icase', function() + reread() + feed(':set diffopt=internal,filler,linematch:20<cr>') + screen:expect([[ + {1: }^DDD │{1: }DDD | + {1: }{2:------------------}│{1: }{4:AAA }| + {1: }{8:_a}{9:a }│{1: }{8:ccc}{9:a }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }| + | + ]]) + feed(':set diffopt+=icase<cr>') + screen:expect([[ + {1: }^DDD │{1: }DDD | + {1: }{8:_}{9:aa }│{1: }{8:A}{9:AA }| + {1: }{2:------------------}│{1: }{4:ccca }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }| + :set diffopt+=icase | + ]]) + end) + end) + + describe('line matching diff algorithm with iwhiteall', function() + setup(function() + local f1 = [[BB + AAA]] + write_file(fname, f1, false) + local f2 = [[BB + AAB +AAAB]] + write_file(fname_2, f2, false) + end) + it('diffopt+=linematch:20,iwhiteall', function() + reread() + feed(':set diffopt=internal,filler,linematch:20<cr>') + screen:expect{grid=[[ + {1: }^BB │{1: }BB | + {1: }{9: AA}{8:A}{9: }│{1: }{9: AA}{8:B}{9: }| + {1: }{2:------------------}│{1: }{4:AAAB }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }| + | + ]]} + feed(':set diffopt+=iwhiteall<cr>') + screen:expect{grid=[[ + {1: }^BB │{1: }BB | + {1: }{2:------------------}│{1: }{4: AAB }| + {1: }{9: AAA }│{1: }{9:AAA}{8:B}{9: }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {6:~ }│{6:~ }| + {7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }| + :set diffopt+=iwhiteall | + ]]} + end) + end) end) it('win_update redraws lines properly', function() |