aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-12-27 22:49:44 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-12-27 22:49:44 +0100
commitc1015121ec626cab6cb384f544bc0be1a1760c0e (patch)
tree6cc9a5d1899a4486a24c491e07d17a7dd01f9503 /test/functional/ui
parent4f030ec24e0e148bbb83aedaef7dd629e5fef130 (diff)
parente1876c7ad1b5e30c0a9919e2c4587d11550c8507 (diff)
downloadrneovim-c1015121ec626cab6cb384f544bc0be1a1760c0e.tar.gz
rneovim-c1015121ec626cab6cb384f544bc0be1a1760c0e.tar.bz2
rneovim-c1015121ec626cab6cb384f544bc0be1a1760c0e.zip
Merge 'upstream/master' into pr-win-erw7
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/bufhl_spec.lua84
-rw-r--r--test/functional/ui/cmdline_spec.lua82
-rw-r--r--test/functional/ui/diff_spec.lua959
-rw-r--r--test/functional/ui/embed_spec.lua5
-rw-r--r--test/functional/ui/highlight_spec.lua34
-rw-r--r--test/functional/ui/hlstate_spec.lua10
-rw-r--r--test/functional/ui/inccommand_spec.lua2
-rw-r--r--test/functional/ui/options_spec.lua116
-rw-r--r--test/functional/ui/output_spec.lua7
-rw-r--r--test/functional/ui/screen.lua28
-rw-r--r--test/functional/ui/screen_basic_spec.lua76
-rw-r--r--test/functional/ui/sign_spec.lua43
12 files changed, 1298 insertions, 148 deletions
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua
index 95c9427399..bcccef84b6 100644
--- a/test/functional/ui/bufhl_spec.lua
+++ b/test/functional/ui/bufhl_spec.lua
@@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local command, neq = helpers.command, helpers.neq
+local meths = helpers.meths
local curbufmeths, eq = helpers.curbufmeths, helpers.eq
describe('Buffer highlighting', function()
@@ -37,8 +38,8 @@ describe('Buffer highlighting', function()
screen:detach()
end)
- local add_hl = curbufmeths.add_highlight
- local clear_hl = curbufmeths.clear_highlight
+ local add_highlight = curbufmeths.add_highlight
+ local clear_namespace = curbufmeths.clear_namespace
it('works', function()
insert([[
@@ -57,8 +58,8 @@ describe('Buffer highlighting', function()
|
]])
- add_hl(-1, "String", 0 , 10, 14)
- add_hl(-1, "Statement", 1 , 5, -1)
+ add_highlight(-1, "String", 0 , 10, 14)
+ add_highlight(-1, "Statement", 1 , 5, -1)
screen:expect([[
these are {2:some} lines |
@@ -83,7 +84,7 @@ describe('Buffer highlighting', function()
|
]])
- clear_hl(-1, 0, -1)
+ clear_namespace(-1, 0, -1)
screen:expect([[
these are some lines |
^ |
@@ -96,7 +97,7 @@ describe('Buffer highlighting', function()
]])
end)
- describe('support adding multiple sources', function()
+ describe('support using multiple namespaces', function()
local id1, id2
before_each(function()
insert([[
@@ -106,21 +107,21 @@ describe('Buffer highlighting', function()
from different sources]])
command("hi ImportantWord gui=bold cterm=bold")
- id1 = add_hl(0, "ImportantWord", 0, 2, 8)
- add_hl(id1, "ImportantWord", 1, 12, -1)
- add_hl(id1, "ImportantWord", 2, 0, 9)
- add_hl(id1, "ImportantWord", 3, 5, 14)
+ id1 = add_highlight(0, "ImportantWord", 0, 2, 8)
+ add_highlight(id1, "ImportantWord", 1, 12, -1)
+ add_highlight(id1, "ImportantWord", 2, 0, 9)
+ add_highlight(id1, "ImportantWord", 3, 5, 14)
-- add_highlight can be called like this to get a new source
-- without adding any highlight
- id2 = add_hl(0, "", 0, 0, 0)
+ id2 = add_highlight(0, "", 0, 0, 0)
neq(id1, id2)
- add_hl(id2, "Special", 0, 2, 8)
- add_hl(id2, "Identifier", 1, 3, 8)
- add_hl(id2, "Special", 1, 14, 20)
- add_hl(id2, "Underlined", 2, 6, 12)
- add_hl(id2, "Underlined", 3, 0, 9)
+ add_highlight(id2, "Special", 0, 2, 8)
+ add_highlight(id2, "Identifier", 1, 3, 8)
+ add_highlight(id2, "Special", 1, 14, 20)
+ add_highlight(id2, "Underlined", 2, 6, 12)
+ add_highlight(id2, "Underlined", 3, 0, 9)
screen:expect([[
a {5:longer} example |
@@ -135,7 +136,21 @@ describe('Buffer highlighting', function()
end)
it('and clearing the first added', function()
- clear_hl(id1, 0, -1)
+ clear_namespace(id1, 0, -1)
+ screen:expect([[
+ a {4:longer} example |
+ in {6:order} to de{4:monstr}ate |
+ combin{9:ing hi}ghlights |
+ {9:from diff}erent source^s |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end)
+
+ it('and clearing using deprecated name', function()
+ curbufmeths.clear_highlight(id1, 0, -1)
screen:expect([[
a {4:longer} example |
in {6:order} to de{4:monstr}ate |
@@ -149,7 +164,7 @@ describe('Buffer highlighting', function()
end)
it('and clearing the second added', function()
- clear_hl(id2, 0, -1)
+ clear_namespace(id2, 0, -1)
screen:expect([[
a {7:longer} example |
in order to {7:demonstrate} |
@@ -163,9 +178,9 @@ describe('Buffer highlighting', function()
end)
it('and clearing line ranges', function()
- clear_hl(-1, 0, 1)
- clear_hl(id1, 1, 2)
- clear_hl(id2, 2, -1)
+ clear_namespace(-1, 0, 1)
+ clear_namespace(id1, 1, 2)
+ clear_namespace(id2, 2, -1)
screen:expect([[
a longer example |
in {6:order} to de{4:monstr}ate |
@@ -208,9 +223,9 @@ describe('Buffer highlighting', function()
it('prioritizes latest added highlight', function()
insert([[
three overlapping colors]])
- add_hl(0, "Identifier", 0, 6, 17)
- add_hl(0, "String", 0, 14, 23)
- local id = add_hl(0, "Special", 0, 0, 9)
+ add_highlight(0, "Identifier", 0, 6, 17)
+ add_highlight(0, "String", 0, 14, 23)
+ local id = add_highlight(0, "Special", 0, 0, 9)
screen:expect([[
{4:three ove}{6:rlapp}{2:ing color}^s |
@@ -223,7 +238,7 @@ describe('Buffer highlighting', function()
|
]])
- clear_hl(id, 0, 1)
+ clear_namespace(id, 0, 1)
screen:expect([[
three {6:overlapp}{2:ing color}^s |
{1:~ }|
@@ -239,8 +254,8 @@ describe('Buffer highlighting', function()
it('works with multibyte text', function()
insert([[
Ta båten över sjön!]])
- add_hl(-1, "Identifier", 0, 3, 9)
- add_hl(-1, "String", 0, 16, 21)
+ add_highlight(-1, "Identifier", 0, 3, 9)
+ add_highlight(-1, "String", 0, 16, 21)
screen:expect([[
Ta {6:båten} över {2:sjön}^! |
@@ -257,7 +272,7 @@ describe('Buffer highlighting', function()
it('works with new syntax groups', function()
insert([[
fancy code in a new fancy language]])
- add_hl(-1, "FancyLangItem", 0, 0, 5)
+ add_highlight(-1, "FancyLangItem", 0, 0, 5)
screen:expect([[
fancy code in a new fancy languag^e |
{1:~ }|
@@ -321,7 +336,7 @@ describe('Buffer highlighting', function()
|
]])
- clear_hl(id1, 0, -1)
+ clear_namespace(id1, 0, -1)
screen:expect([[
^1 + 2 |
3 + |
@@ -449,7 +464,7 @@ describe('Buffer highlighting', function()
|
]])
- clear_hl(-1, 0, -1)
+ clear_namespace(-1, 0, -1)
screen:expect([[
^1 + 2{1:$} |
3 +{1:$} |
@@ -503,4 +518,13 @@ describe('Buffer highlighting', function()
end)
end)
+ it('and virtual text use the same namespace counter', function()
+ local set_virtual_text = curbufmeths.set_virtual_text
+ eq(1, add_highlight(0, "String", 0 , 0, -1))
+ eq(2, set_virtual_text(0, 0, {{"= text", "Comment"}}, {}))
+ eq(3, meths.create_namespace("my-ns"))
+ eq(4, add_highlight(0, "String", 0 , 0, -1))
+ eq(5, set_virtual_text(0, 0, {{"= text", "Comment"}}, {}))
+ eq(6, meths.create_namespace("other-ns"))
+ end)
end)
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 0ebb62f78f..5d112d7f35 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -117,60 +117,60 @@ local function test_cmdline(linegrid)
end)
it('but not with scrolled messages', function()
- screen:try_resize(50,10)
+ screen:try_resize(35,10)
feed(':echoerr doesnotexist<cr>')
screen:expect{grid=[[
- |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {3: }|
- {4:E121: Undefined variable: doesnotexist} |
- {4:E15: Invalid expression: doesnotexist} |
- {5:Press ENTER or type command to continue}^ |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {3: }|
+ {4:E121: Undefined variable: doesnotex}|
+ {4:ist} |
+ {5:Press ENTER or type command to cont}|
+ {5:inue}^ |
]]}
feed(':echoerr doesnotexist<cr>')
screen:expect{grid=[[
- |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {3: }|
- {4:E121: Undefined variable: doesnotexist} |
- {4:E15: Invalid expression: doesnotexist} |
- {4:E121: Undefined variable: doesnotexist} |
- {4:E15: Invalid expression: doesnotexist} |
- {5:Press ENTER or type command to continue}^ |
+ |
+ {1:~ }|
+ {3: }|
+ {4:E121: Undefined variable: doesnotex}|
+ {4:ist} |
+ {5:Press ENTER or type command to cont}|
+ {4:E121: Undefined variable: doesnotex}|
+ {4:ist} |
+ {5:Press ENTER or type command to cont}|
+ {5:inue}^ |
]]}
feed(':echoerr doesnotexist<cr>')
screen:expect{grid=[[
- |
- {1:~ }|
- {3: }|
- {4:E121: Undefined variable: doesnotexist} |
- {4:E15: Invalid expression: doesnotexist} |
- {4:E121: Undefined variable: doesnotexist} |
- {4:E15: Invalid expression: doesnotexist} |
- {4:E121: Undefined variable: doesnotexist} |
- {4:E15: Invalid expression: doesnotexist} |
- {5:Press ENTER or type command to continue}^ |
+ {4:E121: Undefined variable: doesnotex}|
+ {4:ist} |
+ {5:Press ENTER or type command to cont}|
+ {4:E121: Undefined variable: doesnotex}|
+ {4:ist} |
+ {5:Press ENTER or type command to cont}|
+ {4:E121: Undefined variable: doesnotex}|
+ {4:ist} |
+ {5:Press ENTER or type command to cont}|
+ {5:inue}^ |
]]}
feed('<cr>')
screen:expect{grid=[[
- ^ |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {3:n }|
- |
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {3:n }|
+ |
]]}
end)
end)
diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua
new file mode 100644
index 0000000000..8e6756e550
--- /dev/null
+++ b/test/functional/ui/diff_spec.lua
@@ -0,0 +1,959 @@
+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(':e<cr><c-w>w:e<cr><c-w>w')
+ 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 .. '<cr>')
+ feed(':vnew ' .. fname .. '<cr>')
+ feed(':diffthis<cr>')
+ feed('<c-w>w:diffthis<cr><c-w>w')
+
+ 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<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=filler |
+ ]])
+
+ feed(':set diffopt+=internal<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt+=internal |
+ ]])
+ end)
+
+ it('Add a line in beginning of file 1', function()
+ write_file(fname, "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false)
+ write_file(fname_2, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false)
+ reread()
+
+ feed(":set diffopt=filler<cr>")
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=filler |
+ ]])
+
+ feed(":set diffopt+=internal<cr>")
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt+=internal |
+ ]])
+ end)
+
+ it('Add a line at the end of file 2', function()
+ write_file(fname, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false)
+ write_file(fname_2, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n", false)
+ reread()
+
+ feed(":set diffopt=filler<cr>")
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=filler |
+ ]])
+
+ feed(":set diffopt+=internal<cr>")
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt+=internal |
+ ]])
+ end)
+
+ it('Add a line at the end of file 1', function()
+ write_file(fname, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n", false)
+ write_file(fname_2, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false)
+ reread()
+
+ feed(":set diffopt=filler<cr>")
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=filler |
+ ]])
+
+ feed(":set diffopt+=internal<cr>")
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt+=internal |
+ ]])
+ end)
+
+ it('Add a line in the middle of file 2, remove on at the end of file 1', function()
+ write_file(fname, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n", false)
+ write_file(fname_2, "1\n2\n3\n4\n4\n5\n6\n7\n8\n9\n10\n", false)
+ reread()
+
+ feed(':set diffopt=filler<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=filler |
+ ]])
+
+ feed(':set diffopt+=internal<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt+=internal |
+ ]])
+ end)
+
+ it('Add a line in the middle of file 1, remove on at the end of file 2', function()
+ write_file(fname, "1\n2\n3\n4\n4\n5\n6\n7\n8\n9\n10\n", false)
+ write_file(fname_2, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n", false)
+ reread()
+
+ feed(':set diffopt=filler<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=filler |
+ ]])
+
+ feed(':set diffopt+=internal<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt+=internal |
+ ]])
+ end)
+
+ describe('normal/patience/histogram diff algorithm', function()
+ setup(function()
+ local f1 = [[#include <stdio.h>
+
+// 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 <stdio.h>
+
+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<cr>')
+ screen:expect([[
+ {1: }^#include <stdio.h>{3:│}{1: }#include <stdio.h|
+ {1: } {3:│}{1: } |
+ {1: }{8:// Frobs foo heart}{3:│}{1: }{8:int fib(int n)}{9: }|
+ {1: }{4:int frobnitz(int f}{3:│}{1: }{2:-----------------}|
+ {1: }{ {3:│}{1: }{ |
+ {1: }{9: i}{8:nt i;}{9: }{3:│}{1: }{9: i}{8:f(n > 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=internal,filler |
+ ]])
+
+ feed('G')
+ screen:expect([[
+ {1: }{2:------------------}{3:│}{1: }{4:int frobnitz(int }|
+ {1: }{ {3:│}{1: }{ |
+ {1: }{9: i}{8:f(n > 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=internal,filler |
+ ]])
+ end)
+
+ it('diffopt+=algorithm:patience', function()
+ reread()
+ feed(':set diffopt=internal,filler,algorithm:patience<cr>')
+ screen:expect([[
+ {1: }^#include <stdio.h>{3:│}{1: }#include <stdio.h|
+ {1: } {3:│}{1: } |
+ {1: }{2:------------------}{3:│}{1: }{4:int fib(int n) }|
+ {1: }{2:------------------}{3:│}{1: }{4:{ }|
+ {1: }{2:------------------}{3:│}{1: }{4: if(n > 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ |
+ ]])
+
+ feed('G')
+ screen:expect([[
+ {1: } {3:│}{1: } |
+ {1: }{4:int fact(int n) }{3:│}{1: }{2:-----------------}|
+ {1: }{4:{ }{3:│}{1: }{2:-----------------}|
+ {1: }{4: if(n > 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ |
+ ]])
+ end)
+
+ it('diffopt+=algorithm:histogram', function()
+ reread()
+ feed(':set diffopt=internal,filler,algorithm:histogram<cr>')
+ screen:expect([[
+ {1: }^#include <stdio.h>{3:│}{1: }#include <stdio.h|
+ {1: } {3:│}{1: } |
+ {1: }{2:------------------}{3:│}{1: }{4:int fib(int n) }|
+ {1: }{2:------------------}{3:│}{1: }{4:{ }|
+ {1: }{2:------------------}{3:│}{1: }{4: if(n > 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ |
+ ]])
+
+ feed('G')
+ screen:expect([[
+ {1: } {3:│}{1: } |
+ {1: }{4:int fact(int n) }{3:│}{1: }{2:-----------------}|
+ {1: }{4:{ }{3:│}{1: }{2:-----------------}|
+ {1: }{4: if(n > 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ |
+ ]])
+ end)
+ end)
+
+ describe('diffopt+=indent-heuristic', function()
+ setup(function()
+ local f1 = [[
+ def finalize(values)
+
+ values.each do |v|
+ v.finalize
+ end]]
+ write_file(fname, f1, false)
+ local f2 = [[
+ def finalize(values)
+
+ values.each do |v|
+ v.prepare
+ end
+
+ values.each do |v|
+ v.finalize
+ end]]
+ write_file(fname_2, f2, false)
+ feed(':diffupdate!<cr>')
+ end)
+
+ it('internal', function()
+ reread()
+ feed(":set diffopt=internal,filler<cr>")
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=internal,filler |
+ ]])
+ end)
+
+ it('indent-heuristic', function()
+ reread()
+ feed(':set diffopt=internal,filler,indent-heuristic<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ |
+ ]])
+ end)
+
+ it('indent-heuristic random order', function()
+ reread()
+ feed(':set diffopt=internal,filler,indent-heuristic,algorithm:patience<cr>')
+ feed(':<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ : |
+ ]])
+ end)
+ end)
+
+ it('Diff the same file', function()
+ write_file(fname, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false)
+ write_file(fname_2, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false)
+ reread()
+
+ feed(':set diffopt=filler<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=filler |
+ ]])
+
+ feed(':set diffopt+=internal<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt+=internal |
+ ]])
+ end)
+
+ it('Diff an empty file', function()
+ write_file(fname, "", false)
+ write_file(fname_2, "", false)
+ reread()
+
+ feed(':set diffopt=filler<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=filler |
+ ]])
+
+ feed(':set diffopt+=internal<cr>')
+ 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:<onal-diff-screen-1 }{3:<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)
+ reread()
+
+ feed(':set diffopt=filler,icase<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=filler,icase |
+ ]])
+
+ feed(':set diffopt+=internal<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt+=internal |
+ ]])
+ end)
+
+ describe('diffopt+=iwhite', function()
+ setup(function()
+ local f1 = 'int main()\n{\n printf("Hello, World!");\n return 0;\n}\n'
+ write_file(fname, f1, false)
+ local f2 = 'int main()\n{\n if (0)\n {\n printf("Hello, World!");\n return 0;\n }\n}\n'
+ write_file(fname_2, f2, false)
+ feed(':diffupdate!<cr>')
+ end)
+
+ it('external', function()
+ reread()
+ feed(':set diffopt=filler,iwhite<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=filler,iwhite |
+ ]])
+ end)
+
+ it('internal', function()
+ reread()
+ feed(':set diffopt=filler,iwhite,internal<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=filler,iwhite,internal |
+ ]])
+ 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!<cr>')
+ end)
+
+ it('generic', function()
+ reread()
+ feed(':set diffopt=internal,filler,iblank<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ :set diffopt=internal,filler,iblank |
+ ]])
+ end)
+
+ it('diffopt+=iwhite', function()
+ reread()
+ feed(':set diffopt=internal,filler,iblank,iwhite<cr>')
+ feed(':<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ : |
+ ]])
+ end)
+
+ it('diffopt+=iwhiteall', function()
+ reread()
+ feed(':set diffopt=internal,filler,iblank,iwhiteall<cr>')
+ feed(':<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ : |
+ ]])
+ end)
+
+ it('diffopt+=iwhiteeol', function()
+ reread()
+ feed(':set diffopt=internal,filler,iblank,iwhiteeol<cr>')
+ feed(':<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ : |
+ ]])
+ end)
+ end)
+
+ describe('diffopt+=iwhite{eol,all}', function()
+ setup(function()
+ write_file(fname, 'a \nx\ncd\nef\nxx xx\nfoo\nbar\n', false)
+ write_file(fname_2, 'a\nx\nc d\n ef\nxx xx\nfoo\n\nbar\n', false)
+ feed(':diffupdate!<cr>')
+ end)
+
+ it('diffopt+=iwhiteeol', function()
+ reread()
+ feed(':set diffopt=internal,filler,iwhiteeol<cr>')
+ feed(':<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ : |
+ ]])
+ end)
+
+ it('diffopt+=iwhiteall', function()
+ reread()
+ feed(':set diffopt=internal,filler,iwhiteall<cr>')
+ feed(':<cr>')
+ 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:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ : |
+ ]])
+ end)
+ end)
+end)
diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua
index 4fc93c3b63..10dbc68672 100644
--- a/test/functional/ui/embed_spec.lua
+++ b/test/functional/ui/embed_spec.lua
@@ -17,6 +17,7 @@ local function test_embed(ext_linegrid)
[1] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
[2] = {bold = true, foreground = Screen.colors.SeaGreen4},
[3] = {bold = true, foreground = Screen.colors.Blue1},
+ [4] = {bold = true, foreground = Screen.colors.Green},
})
end
@@ -27,9 +28,9 @@ local function test_embed(ext_linegrid)
|
|
|
+ |
Error detected while processing pre-vimrc command line: |
E121: Undefined variable: invalid |
- E15: Invalid expression: invalid+ |
Press ENTER or type command to continue^ |
]])
@@ -56,7 +57,7 @@ local function test_embed(ext_linegrid)
Error detected while processing pre-vimrc command line: |
foo |
{1:bar} |
- {2:Press ENTER or type command to continue}^ |
+ {4:Press ENTER or type command to continue}^ |
]])
end)
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 55fc343e4c..96f6b43320 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -768,6 +768,40 @@ describe('CursorLine highlight', function()
{4:[No Name] [+] }{9:[No Name] [+] }|
|
]])
+
+ -- CursorLine with fg=NONE is "low-priority".
+ -- Rendered as underline in a diff-line. #9028
+ command('hi CursorLine ctermbg=red ctermfg=NONE guibg=red guifg=NONE')
+ feed('kkkk')
+ screen:expect([[
+ {1: }line 1 some text {4:│}{1: }line 1 some text |
+ {1: }{11:line 2 mo}{12:Re text!}{11: }{4:│}{1: }{11:^line 2 mo}{12:re text}{11: }|
+ {1: }{5:extra line! }{4:│}{1: }{6:----------------------}|
+ {1: }extra line! {4:│}{1: }extra line! |
+ {1: }extra line! {4:│}{1: }extra line! |
+ {1: }last line ... {4:│}{1: }last line ... |
+ {1: } {4:│}{1: } |
+ {1: }{8:~ }{4:│}{1: }{8:~ }|
+ {1: }{8:~ }{4:│}{1: }{8:~ }|
+ {1: }{8:~ }{4:│}{1: }{8:~ }|
+ {4:[No Name] [+] }{9:[No Name] [+] }|
+ |
+ ]], {
+ [1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
+ [2] = {bold = true, background = Screen.colors.Red},
+ [3] = {background = Screen.colors.LightMagenta},
+ [4] = {reverse = true},
+ [5] = {background = Screen.colors.LightBlue},
+ [6] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1},
+ [7] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ [8] = {bold = true, foreground = Screen.colors.Blue1},
+ [9] = {bold = true, reverse = true},
+ [10] = {bold = true},
+ [11] = {underline = true,
+ background = Screen.colors.LightMagenta},
+ [12] = {bold = true, underline = true,
+ background = Screen.colors.Red},
+ })
end)
end)
diff --git a/test/functional/ui/hlstate_spec.lua b/test/functional/ui/hlstate_spec.lua
index 672af5fb22..775b701438 100644
--- a/test/functional/ui/hlstate_spec.lua
+++ b/test/functional/ui/hlstate_spec.lua
@@ -177,11 +177,11 @@ describe('ext_hlstate detailed highlights', function()
it("work with :terminal", function()
screen:set_default_attr_ids({
[1] = {{}, {{hi_name = "TermCursorNC", ui_name = "TermCursorNC", kind = "ui"}}},
- [2] = {{special = Screen.colors.Grey0, foreground = 52479}, {{kind = "term"}}},
- [3] = {{special = Screen.colors.Grey0, bold = true, foreground = 52479}, {{kind = "term"}}},
- [4] = {{special = Screen.colors.Grey0, foreground = 52479}, {2, 1}},
- [5] = {{special = Screen.colors.Grey0, foreground = 4259839}, {{kind = "term"}}},
- [6] = {{special = Screen.colors.Grey0, foreground = 4259839}, {5, 1}},
+ [2] = {{foreground = 52479}, {{kind = "term"}}},
+ [3] = {{bold = true, foreground = 52479}, {{kind = "term"}}},
+ [4] = {{foreground = 52479}, {2, 1}},
+ [5] = {{foreground = 4259839}, {{kind = "term"}}},
+ [6] = {{foreground = 4259839}, {5, 1}},
})
command('enew | call termopen(["'..nvim_dir..'/tty-test"])')
screen:expect([[
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 736a314426..bb6cb543ed 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -2512,7 +2512,7 @@ describe(":substitute", function()
end)
it(':substitute with inccommand during :terminal activity', function()
- retry(2, nil, function()
+ retry(2, 40000, function()
local screen = Screen.new(30,15)
clear()
diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua
index 99aae16183..32e8faf7d3 100644
--- a/test/functional/ui/options_spec.lua
+++ b/test/functional/ui/options_spec.lua
@@ -1,85 +1,85 @@
+local global_helpers = require('test.helpers')
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local command = helpers.command
local eq = helpers.eq
+local shallowcopy = global_helpers.shallowcopy
describe('ui receives option updates', function()
local screen
- before_each(function()
- clear()
+ local function reset(opts, ...)
+ local defaults = {
+ ambiwidth='single',
+ arabicshape=true,
+ emoji=true,
+ guifont='',
+ guifontset='',
+ guifontwide='',
+ linespace=0,
+ showtabline=1,
+ termguicolors=false,
+ ext_cmdline=false,
+ ext_popupmenu=false,
+ ext_tabline=false,
+ ext_wildmenu=false,
+ ext_linegrid=false,
+ ext_hlstate=false,
+ }
+
+ clear(...)
screen = Screen.new(20,5)
- end)
+ screen:attach(opts)
+ -- NB: UI test suite can be run in both "linegrid" and legacy grid mode.
+ -- In both cases check that the received value is the one requested.
+ defaults.ext_linegrid = screen._options.ext_linegrid or false
+ return defaults
+ end
after_each(function()
screen:detach()
end)
- local defaults = {
- ambiwidth='single',
- arabicshape=true,
- emoji=true,
- guifont='',
- guifontset='',
- guifontwide='',
- linespace=0,
- showtabline=1,
- termguicolors=false,
- ext_cmdline=false,
- ext_popupmenu=false,
- ext_tabline=false,
- ext_wildmenu=false,
- ext_linegrid=false,
- ext_hlstate=false,
- }
-
it("for defaults", function()
- screen:attach()
- -- NB: UI test suite can be run in both "linegrid" and legacy grid mode.
- -- In both cases check that the received value is the one requested.
- defaults.ext_linegrid = screen._options.ext_linegrid or false
+ local expected = reset()
screen:expect(function()
- eq(defaults, screen.options)
+ eq(expected, screen.options)
end)
end)
it("when setting options", function()
- screen:attach()
- defaults.ext_linegrid = screen._options.ext_linegrid or false
- local changed = {}
- for k,v in pairs(defaults) do
- changed[k] = v
- end
+ local expected = reset()
+ local defaults = shallowcopy(expected)
command("set termguicolors")
- changed.termguicolors = true
+ expected.termguicolors = true
screen:expect(function()
- eq(changed, screen.options)
+ eq(expected, screen.options)
end)
command("set guifont=Comic\\ Sans")
- changed.guifont = "Comic Sans"
+ expected.guifont = "Comic Sans"
screen:expect(function()
- eq(changed, screen.options)
+ eq(expected, screen.options)
end)
command("set showtabline=0")
- changed.showtabline = 0
+ expected.showtabline = 0
screen:expect(function()
- eq(changed, screen.options)
+ eq(expected, screen.options)
end)
command("set linespace=13")
- changed.linespace = 13
+ expected.linespace = 13
screen:expect(function()
- eq(changed, screen.options)
+ eq(expected, screen.options)
end)
command("set linespace=-11")
- changed.linespace = -11
+ expected.linespace = -11
screen:expect(function()
- eq(changed, screen.options)
+ eq(expected, screen.options)
end)
command("set all&")
@@ -89,29 +89,35 @@ describe('ui receives option updates', function()
end)
it('with UI extensions', function()
- local changed = {}
- for k,v in pairs(defaults) do
- changed[k] = v
- end
+ local expected = reset({ext_cmdline=true, ext_wildmenu=true})
- screen:attach({ext_cmdline=true, ext_wildmenu=true})
- defaults.ext_linegrid = screen._options.ext_linegrid or false
- changed.ext_cmdline = true
- changed.ext_wildmenu = true
+ expected.ext_cmdline = true
+ expected.ext_wildmenu = true
screen:expect(function()
- eq(changed, screen.options)
+ eq(expected, screen.options)
end)
screen:set_option('ext_popupmenu', true)
- changed.ext_popupmenu = true
+ expected.ext_popupmenu = true
screen:expect(function()
- eq(changed, screen.options)
+ eq(expected, screen.options)
end)
screen:set_option('ext_wildmenu', false)
- changed.ext_wildmenu = false
+ expected.ext_wildmenu = false
screen:expect(function()
- eq(changed, screen.options)
+ eq(expected, screen.options)
end)
end)
+
+ local function startup_test(headless)
+ local expected = reset(nil,{headless=headless,args={'--cmd', 'set guifont=Comic\\ Sans\\ 12'}})
+ expected.guifont = "Comic Sans 12"
+ screen:expect(function()
+ eq(expected, screen.options)
+ end)
+ end
+
+ it('from startup options with --headless', function() startup_test(true) end)
+ it('from startup options with --embed', function() startup_test(false) end)
end)
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua
index 1850d436ac..aa99499ec6 100644
--- a/test/functional/ui/output_spec.lua
+++ b/test/functional/ui/output_spec.lua
@@ -68,7 +68,12 @@ describe("shell command :!", function()
|
{10:Press ENTER or type command to continue}{1: } |
{3:-- TERMINAL --} |
- ]])
+ ]], {
+ -- test/functional/helpers.lua defaults to background=light.
+ [1] = {reverse = true},
+ [3] = {bold = true},
+ [10] = {foreground = 2},
+ })
end)
end)
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index af036913d8..75eb5bb4e3 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -72,6 +72,7 @@
-- To debug screen tests, see Screen:redraw_debug().
local global_helpers = require('test.helpers')
+local deepcopy = global_helpers.deepcopy
local shallowcopy = global_helpers.shallowcopy
local helpers = require('test.functional.helpers')(nil)
local request, run, uimeths = helpers.request, helpers.run, helpers.uimeths
@@ -176,6 +177,10 @@ function Screen:set_default_attr_ids(attr_ids)
self._default_attr_ids = attr_ids
end
+function Screen:get_default_attr_ids()
+ return deepcopy(self._default_attr_ids)
+end
+
function Screen:set_default_attr_ignore(attr_ignore)
self._default_attr_ignore = attr_ignore
end
@@ -489,7 +494,7 @@ function Screen:_wait(check, flags)
if warn_immediate and immediate_seen then
print([[
-Warning: A screen test has immediate success. Try to avoid this unless the
+warning: Screen test succeeded immediately. Try to avoid this unless the
purpose of the test really requires it.]])
if intermediate_seen then
print([[
@@ -498,8 +503,7 @@ Use screen:snapshot_util() or screen:redraw_debug() to find them, and add them
to the test if they make sense.
]])
else
- print([[If necessary, silence this warning by
-supplying the 'unchanged' argument to screen:expect.]])
+ print([[If necessary, silence this warning with 'unchanged' argument of screen:expect.]])
end
did_warn = true
end
@@ -507,19 +511,17 @@ supplying the 'unchanged' argument to screen:expect.]])
if failure_after_success then
print([[
-Warning: Screen changes were received after the expected state. This indicates
+warning: Screen changes were received after the expected state. This indicates
indeterminism in the test. Try adding screen:expect(...) (or wait()) between
asynchronous (feed(), nvim_input()) and synchronous API calls.
- - Use Screen:redraw_debug() to investigate the problem. It might find
- relevant intermediate states that should be added to the test to make it
- more robust.
- - If the point of the test is to assert the state after some user input
- sent with feed(...), also adding an screen:expect(...) before the feed(...)
- will help ensure the input is sent to nvim when nvim is in a predictable
- state. This is preferable to using wait(), as it is more closely emulates
- real user interaction.
+ - Use screen:redraw_debug() to investigate; it may find relevant intermediate
+ states that should be added to the test to make it more robust.
+ - If the purpose of the test is to assert state after some user input sent
+ with feed(), adding screen:expect() before the feed() will help to ensure
+ the input is sent when Nvim is in a predictable state. This is preferable
+ to wait(), for being closer to real user interaction.
- wait() can trigger redraws and consequently generate more indeterminism.
- In that case try removing every wait().
+ Try removing wait().
]])
did_warn = true
end
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index 1a8b7d543a..04d532f6e1 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -156,6 +156,82 @@ local function screen_tests(linegrid)
end)
end)
+ describe('statusline', function()
+ it('is redrawn after <c-l>', function()
+ command('set laststatus=2')
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:[No Name] }|
+ |
+ ]])
+
+ feed('<c-l>')
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:[No Name] }|
+ |
+ ]], reset=true}
+
+ command('split')
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:[No Name] }|
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:[No Name] }|
+ |
+ ]])
+
+ feed('<c-l>')
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:[No Name] }|
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:[No Name] }|
+ |
+ ]], reset=true}
+ end)
+ end)
+
describe('window', function()
describe('split', function()
it('horizontal', function()
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua
index 6abeb0b2f4..bc0e2e3799 100644
--- a/test/functional/ui/sign_spec.lua
+++ b/test/functional/ui/sign_spec.lua
@@ -20,6 +20,9 @@ describe('Signs', function()
[6] = {foreground = Screen.colors.Brown},
[7] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey},
[8] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ [9] = {bold = true, foreground = Screen.colors.Magenta},
+ [10] = {foreground = Screen.colors.Blue1},
+ [11] = {bold = true, foreground = Screen.colors.SeaGreen4},
} )
end)
@@ -111,5 +114,45 @@ describe('Signs', function()
|
]])
end)
+
+ it('can have 32bit sign IDs', function()
+ command('sign define piet text=>> texthl=Search')
+ command('sign place 100000 line=1 name=piet buffer=1')
+ feed(':sign place<cr>')
+ screen:expect([[
+ {1:>>} |
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {4: }|
+ :sign place |
+ {9:--- Signs ---} |
+ {10:Signs for [NULL]:} |
+ line=1 id=100000 name=piet |
+ |
+ {11:Press ENTER or type command to continue}^ |
+ ]])
+
+ feed('<cr>')
+ screen:expect([[
+ {1:>>}^ |
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ {2: }{0:~ }|
+ |
+ ]])
+ end)
end)
end)