aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-10-13 20:18:22 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2019-10-13 22:10:42 +0200
commit4987311fb5b8f4a11d26995f71f5f402a9e2ace4 (patch)
treee070d02687ba338260a004be738e777b1639e508 /test/functional/ui
parenta330129a280a34963e42d498f7cb1f53e6723e85 (diff)
downloadrneovim-4987311fb5b8f4a11d26995f71f5f402a9e2ace4.tar.gz
rneovim-4987311fb5b8f4a11d26995f71f5f402a9e2ace4.tar.bz2
rneovim-4987311fb5b8f4a11d26995f71f5f402a9e2ace4.zip
tests/ui: remove unnecessary screen:detach()
It is perfectly fine and expected to detach from the screen just by the UI disconnecting from nvim or exiting nvim. Just keep detach() in screen_basic_spec, to get some coverage of the detach method itself. This avoids hang on failure in many situations (though one could argue that detach() should be "fast", or at least "as fast as resize", which works in press-return already). Never use detach() just to change the size of the screen, try_resize() method exists for that specifically.
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/bufhl_spec.lua4
-rw-r--r--test/functional/ui/cmdline_spec.lua8
-rw-r--r--test/functional/ui/cursor_spec.lua4
-rw-r--r--test/functional/ui/fold_spec.lua4
-rw-r--r--test/functional/ui/highlight_spec.lua31
-rw-r--r--test/functional/ui/inccommand_spec.lua15
-rw-r--r--test/functional/ui/mouse_spec.lua4
-rw-r--r--test/functional/ui/multibyte_spec.lua8
-rw-r--r--test/functional/ui/multigrid_spec.lua4
-rw-r--r--test/functional/ui/options_spec.lua4
-rw-r--r--test/functional/ui/output_spec.lua1
-rw-r--r--test/functional/ui/sign_spec.lua4
-rw-r--r--test/functional/ui/spell_spec.lua4
-rw-r--r--test/functional/ui/syntax_conceal_spec.lua4
-rw-r--r--test/functional/ui/tabline_spec.lua4
15 files changed, 7 insertions, 96 deletions
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua
index d8ca947645..5df909f79c 100644
--- a/test/functional/ui/bufhl_spec.lua
+++ b/test/functional/ui/bufhl_spec.lua
@@ -37,10 +37,6 @@ describe('Buffer highlighting', function()
})
end)
- after_each(function()
- screen:detach()
- end)
-
local add_highlight = curbufmeths.add_highlight
local clear_namespace = curbufmeths.clear_namespace
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index f9769c706f..fe1b2c13d1 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -25,10 +25,6 @@ local function test_cmdline(linegrid)
screen = new_screen({rgb=true, ext_cmdline=true, ext_linegrid=linegrid})
end)
- after_each(function()
- screen:detach()
- end)
-
it('works', function()
feed(':')
screen:expect{grid=[[
@@ -804,10 +800,6 @@ describe('cmdline redraw', function()
screen = new_screen({rgb=true})
end)
- after_each(function()
- screen:detach()
- end)
-
it('with timer', function()
feed(':012345678901234567890123456789')
screen:expect{grid=[[
diff --git a/test/functional/ui/cursor_spec.lua b/test/functional/ui/cursor_spec.lua
index 67aba919b0..8ad4182f41 100644
--- a/test/functional/ui/cursor_spec.lua
+++ b/test/functional/ui/cursor_spec.lua
@@ -13,10 +13,6 @@ describe('ui/cursor', function()
screen:attach()
end)
- after_each(function()
- screen:detach()
- end)
-
it("'guicursor' is published as a UI event", function()
local expected_mode_info = {
[1] = {
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua
index c5ef718883..eb81aba131 100644
--- a/test/functional/ui/fold_spec.lua
+++ b/test/functional/ui/fold_spec.lua
@@ -24,10 +24,6 @@ describe("folded lines", function()
})
end)
- after_each(function()
- screen:detach()
- end)
-
it("work with more than one signcolumn", function()
command("set signcolumn=yes:9")
feed("i<cr><esc>")
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 1b25570997..d7791a3107 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -35,7 +35,6 @@ describe('highlight: `:syntax manual`', function()
end)
after_each(function()
- screen:detach()
os.remove('Xtest-functional-ui-highlight.tmp.vim')
end)
@@ -97,10 +96,6 @@ describe('highlight defaults', function()
command("set display-=msgsep")
end)
- after_each(function()
- screen:detach()
- end)
-
it('window status bar', function()
screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
@@ -346,17 +341,10 @@ describe('highlight defaults', function()
end)
describe('highlight', function()
- local screen
-
- before_each(function()
- clear()
- screen = Screen.new(25,10)
- screen:attach()
- end)
+ before_each(clear)
it('visual', function()
- screen:detach()
- screen = Screen.new(20,4)
+ local screen = Screen.new(20,4)
screen:attach()
screen:set_default_attr_ids({
[1] = {background = Screen.colors.LightGrey},
@@ -389,8 +377,7 @@ describe('highlight', function()
end)
it('cterm=standout gui=standout', function()
- screen:detach()
- screen = Screen.new(20,5)
+ local screen = Screen.new(20,5)
screen:attach()
screen:set_default_attr_ids({
[1] = {bold = true, foreground = Screen.colors.Blue1},
@@ -413,8 +400,7 @@ describe('highlight', function()
end)
it('strikethrough', function()
- screen:detach()
- screen = Screen.new(25,6)
+ local screen = Screen.new(25,6)
screen:attach()
feed_command('syntax on')
feed_command('syn keyword TmpKeyword foo')
@@ -439,8 +425,7 @@ describe('highlight', function()
end)
it('nocombine', function()
- screen:detach()
- screen = Screen.new(25,6)
+ local screen = Screen.new(25,6)
screen:set_default_attr_ids{
[1] = {foreground = Screen.colors.SlateBlue, underline = true},
[2] = {bold = true, foreground = Screen.colors.Blue1},
@@ -487,6 +472,8 @@ describe('highlight', function()
end)
it('guisp (special/undercurl)', function()
+ local screen = Screen.new(25,10)
+ screen:attach()
feed_command('syntax on')
feed_command('syn keyword TmpKeyword neovim')
feed_command('syn keyword TmpKeyword1 special')
@@ -542,10 +529,6 @@ describe("'listchars' highlight", function()
screen:attach()
end)
- after_each(function()
- screen:detach()
- end)
-
it("'cursorline' and 'cursorcolumn'", function()
screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index e9a7c8c2df..d60cd08fb0 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -556,7 +556,6 @@ describe(":substitute, 'inccommand' preserves undo", function()
]])
end
end
- screen:detach()
end)
it('with undolevels=2', function()
@@ -647,7 +646,6 @@ describe(":substitute, 'inccommand' preserves undo", function()
Already ...t change |
]])
end
- screen:detach()
end
end)
@@ -713,7 +711,6 @@ describe(":substitute, 'inccommand' preserves undo", function()
Already ...t change |
]])
end
- screen:detach()
end)
end)
@@ -726,10 +723,6 @@ describe(":substitute, inccommand=split", function()
common_setup(screen, "split", default_text .. default_text)
end)
- after_each(function()
- screen:detach()
- end)
-
it("preserves 'modified' buffer flag", function()
feed_command("set nomodified")
feed(":%s/tw")
@@ -1241,10 +1234,6 @@ describe("inccommand=nosplit", function()
common_setup(screen, "nosplit", default_text .. default_text)
end)
- after_each(function()
- if screen then screen:detach() end
- end)
-
it("works with :smagic, :snomagic", function()
feed_command("set hlsearch")
insert("Line *.3.* here")
@@ -1719,10 +1708,6 @@ describe("'inccommand' split windows", function()
common_setup(screen, "split", default_text)
end
- after_each(function()
- screen:detach()
- end)
-
it('work after more splits', function()
refresh()
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index fedef7da8a..7840ba9167 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -40,10 +40,6 @@ describe('ui/mouse/input', function()
]])
end)
- after_each(function()
- screen:detach()
- end)
-
it('single left click moves cursor', function()
feed('<LeftMouse><2,1>')
screen:expect([[
diff --git a/test/functional/ui/multibyte_spec.lua b/test/functional/ui/multibyte_spec.lua
index 3e63353ad2..8122cb08a3 100644
--- a/test/functional/ui/multibyte_spec.lua
+++ b/test/functional/ui/multibyte_spec.lua
@@ -21,10 +21,6 @@ describe("multibyte rendering", function()
})
end)
- after_each(function()
- screen:detach()
- end)
-
it("works with composed char at start of line", function()
insert([[
̊
@@ -131,10 +127,6 @@ describe('multibyte rendering: statusline', function()
command('set laststatus=2')
end)
- after_each(function()
- screen:detach()
- end)
-
it('last char shows (multibyte)', function()
command('set statusline=你好')
screen:expect([[
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua
index 30a5b63d89..01ffe80be3 100644
--- a/test/functional/ui/multigrid_spec.lua
+++ b/test/functional/ui/multigrid_spec.lua
@@ -37,10 +37,6 @@ describe('ext_multigrid', function()
})
end)
- after_each(function()
- screen:detach()
- end)
-
it('default initial screen', function()
screen:expect{grid=[[
## grid 1
diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua
index 93192934c7..ea71f5eae9 100644
--- a/test/functional/ui/options_spec.lua
+++ b/test/functional/ui/options_spec.lua
@@ -40,10 +40,6 @@ describe('ui receives option updates', function()
return defaults
end
- after_each(function()
- screen:detach()
- end)
-
it("for defaults", function()
local expected = reset()
screen:expect(function()
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua
index 20413cb784..a201dfe898 100644
--- a/test/functional/ui/output_spec.lua
+++ b/test/functional/ui/output_spec.lua
@@ -31,7 +31,6 @@ describe("shell command :!", function()
after_each(function()
child_session.feed_data("\3") -- Ctrl-C
- screen:detach()
end)
it("displays output without LF/EOF. #4646 #4569 #3772", function()
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua
index 68e675b8e5..0ed62b21b2 100644
--- a/test/functional/ui/sign_spec.lua
+++ b/test/functional/ui/sign_spec.lua
@@ -26,10 +26,6 @@ describe('Signs', function()
} )
end)
- after_each(function()
- screen:detach()
- end)
-
describe(':sign place', function()
it('allows signs with combining characters', function()
feed('ia<cr>b<cr><esc>')
diff --git a/test/functional/ui/spell_spec.lua b/test/functional/ui/spell_spec.lua
index 913f1b9bed..243b737583 100644
--- a/test/functional/ui/spell_spec.lua
+++ b/test/functional/ui/spell_spec.lua
@@ -20,10 +20,6 @@ describe("'spell'", function()
})
end)
- after_each(function()
- screen:detach()
- end)
-
it('joins long lines #7937', function()
feed_command('set spell')
insert([[
diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua
index 566d183f11..d1af0e955c 100644
--- a/test/functional/ui/syntax_conceal_spec.lua
+++ b/test/functional/ui/syntax_conceal_spec.lua
@@ -22,10 +22,6 @@ describe('Screen', function()
} )
end)
- after_each(function()
- screen:detach()
- end)
-
describe("match and conceal", function()
before_each(function()
diff --git a/test/functional/ui/tabline_spec.lua b/test/functional/ui/tabline_spec.lua
index dcab9f7ef4..0ee7e03fac 100644
--- a/test/functional/ui/tabline_spec.lua
+++ b/test/functional/ui/tabline_spec.lua
@@ -17,10 +17,6 @@ describe('ui/ext_tabline', function()
end)
end)
- after_each(function()
- screen:detach()
- end)
-
it('publishes UI events', function()
command("tabedit another-tab")