diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-11-11 22:15:19 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2024-11-14 12:40:57 +0100 |
commit | e61228a214ebda9845db9462dad0a8c362d3963f (patch) | |
tree | fc5908c85c0cc6affc3bc325cd75f6efaeea95d8 /test/functional/plugin | |
parent | 40dee8a2dcba996badaa6182eb34fde1694f92a3 (diff) | |
download | rneovim-e61228a214ebda9845db9462dad0a8c362d3963f.tar.gz rneovim-e61228a214ebda9845db9462dad0a8c362d3963f.tar.bz2 rneovim-e61228a214ebda9845db9462dad0a8c362d3963f.zip |
fix(tests): needing two calls to setup a screen is cringe
Before calling "attach" a screen object is just a dummy container for
(row, col) values whose purpose is to be sent as part of the "attach"
function call anyway.
Just create the screen in an attached state directly. Keep the complete
(row, col, options) config together. It is still completely valid to
later detach and re-attach as needed, including to another session.
Diffstat (limited to 'test/functional/plugin')
-rw-r--r-- | test/functional/plugin/health_spec.lua | 10 | ||||
-rw-r--r-- | test/functional/plugin/lsp/inlay_hint_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/plugin/lsp/semantic_tokens_spec.lua | 1 | ||||
-rw-r--r-- | test/functional/plugin/lsp/utils_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/plugin/man_spec.lua | 1 | ||||
-rw-r--r-- | test/functional/plugin/matchparen_spec.lua | 1 | ||||
-rw-r--r-- | test/functional/plugin/shada_spec.lua | 1 | ||||
-rw-r--r-- | test/functional/plugin/tohtml_spec.lua | 3 | ||||
-rw-r--r-- | test/functional/plugin/tutor_spec.lua | 1 | ||||
-rw-r--r-- | test/functional/plugin/vim_syntax_spec.lua | 1 |
10 files changed, 5 insertions, 20 deletions
diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index 7089313303..753da64522 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -155,7 +155,6 @@ describe('vim.health', function() it('highlights OK, ERROR', function() local screen = Screen.new(50, 12) - screen:attach() screen:set_default_attr_ids({ h1 = { reverse = true }, h2 = { foreground = tonumber('0x6a0dad') }, @@ -222,7 +221,7 @@ describe(':checkhealth window', function() end) it('opens directly if no buffer created', function() - local screen = Screen.new(50, 12) + local screen = Screen.new(50, 12, { ext_multigrid = true }) screen:set_default_attr_ids { h1 = { reverse = true }, h2 = { foreground = tonumber('0x6a0dad') }, @@ -230,7 +229,6 @@ describe(':checkhealth window', function() [14] = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray }, [32] = { foreground = Screen.colors.PaleGreen2 }, } - screen:attach({ ext_multigrid = true }) command('checkhealth success1') screen:expect { grid = [[ @@ -256,7 +254,7 @@ describe(':checkhealth window', function() end) local function test_health_vsplit(left, emptybuf, mods) - local screen = Screen.new(50, 20) + local screen = Screen.new(50, 20, { ext_multigrid = true }) screen:set_default_attr_ids { h1 = { reverse = true }, h2 = { foreground = tonumber('0x6a0dad') }, @@ -264,7 +262,6 @@ describe(':checkhealth window', function() [14] = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray }, [32] = { foreground = Screen.colors.PaleGreen2 }, } - screen:attach({ ext_multigrid = true }) if not emptybuf then insert('hello') end @@ -322,8 +319,7 @@ describe(':checkhealth window', function() end local function test_health_split(top, emptybuf, mods) - local screen = Screen.new(50, 25) - screen:attach({ ext_multigrid = true }) + local screen = Screen.new(50, 25, { ext_multigrid = true }) screen._default_attr_ids = nil if not emptybuf then insert('hello') diff --git a/test/functional/plugin/lsp/inlay_hint_spec.lua b/test/functional/plugin/lsp/inlay_hint_spec.lua index 471f2cc3e8..fc6c3f46f7 100644 --- a/test/functional/plugin/lsp/inlay_hint_spec.lua +++ b/test/functional/plugin/lsp/inlay_hint_spec.lua @@ -67,7 +67,6 @@ int main() { before_each(function() clear_notrace() screen = Screen.new(50, 9) - screen:attach() bufnr = n.api.nvim_get_current_buf() exec_lua(create_server_definition) @@ -339,7 +338,6 @@ test text before_each(function() clear_notrace() screen = Screen.new(50, 3) - screen:attach() exec_lua(create_server_definition) bufnr = n.api.nvim_get_current_buf() diff --git a/test/functional/plugin/lsp/semantic_tokens_spec.lua b/test/functional/plugin/lsp/semantic_tokens_spec.lua index f72aab7e0b..280bd27207 100644 --- a/test/functional/plugin/lsp/semantic_tokens_spec.lua +++ b/test/functional/plugin/lsp/semantic_tokens_spec.lua @@ -28,7 +28,6 @@ describe('semantic token highlighting', function() local screen --- @type test.functional.ui.screen before_each(function() screen = Screen.new(40, 16) - screen:attach() screen:set_default_attr_ids { [1] = { bold = true, foreground = Screen.colors.Blue1 }, [2] = { foreground = Screen.colors.DarkCyan }, diff --git a/test/functional/plugin/lsp/utils_spec.lua b/test/functional/plugin/lsp/utils_spec.lua index 64d58eeffd..813b8de812 100644 --- a/test/functional/plugin/lsp/utils_spec.lua +++ b/test/functional/plugin/lsp/utils_spec.lua @@ -181,11 +181,9 @@ describe('vim.lsp.util', function() eq(expected_anchor, string.sub(opts.anchor, 1, 1)) end - local screen --- @type test.functional.ui.screen before_each(function() n.clear() - screen = Screen.new(80, 80) - screen:attach() + local _ = Screen.new(80, 80) feed('79i<CR><Esc>') -- fill screen with empty lines end) diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua index 6f0eeff748..8906e60dce 100644 --- a/test/functional/plugin/man_spec.lua +++ b/test/functional/plugin/man_spec.lua @@ -60,7 +60,6 @@ describe(':Man', function() c = { foreground = Screen.colors.Blue }, -- control chars eob = { bold = true, foreground = Screen.colors.Blue }, -- empty line '~'s }) - screen:attach() end) it('clears backspaces from text and adds highlights', function() diff --git a/test/functional/plugin/matchparen_spec.lua b/test/functional/plugin/matchparen_spec.lua index ae718ac1bd..b2bbdb2ef6 100644 --- a/test/functional/plugin/matchparen_spec.lua +++ b/test/functional/plugin/matchparen_spec.lua @@ -14,7 +14,6 @@ describe('matchparen', function() before_each(function() clear { args = { '-u', 'NORC' } } screen = Screen.new(20, 5) - screen:attach() screen:set_default_attr_ids({ [0] = { bold = true, foreground = 255 }, [1] = { bold = true }, diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua index c9d49f7d01..f33819f364 100644 --- a/test/functional/plugin/shada_spec.lua +++ b/test/functional/plugin/shada_spec.lua @@ -3053,7 +3053,6 @@ describe('syntax/shada.vim', function() [7] = { bold = true, reverse = true }, [8] = { bold = true, foreground = Screen.colors.Blue }, } - screen:attach() api.nvim_buf_set_lines(0, 0, 1, true, { 'Header with timestamp ' .. epoch .. ':', diff --git a/test/functional/plugin/tohtml_spec.lua b/test/functional/plugin/tohtml_spec.lua index 1d05f4d6b4..afd4169006 100644 --- a/test/functional/plugin/tohtml_spec.lua +++ b/test/functional/plugin/tohtml_spec.lua @@ -185,8 +185,7 @@ describe(':TOhtml', function() local screen before_each(function() clear({ args = { '--clean' } }) - screen = Screen.new(80, 80) - screen:attach({ term_name = 'xterm' }) + screen = Screen.new(80, 80, { term_name = 'xterm' }) exec('colorscheme default') end) diff --git a/test/functional/plugin/tutor_spec.lua b/test/functional/plugin/tutor_spec.lua index 9f381d45db..09cd22ab6c 100644 --- a/test/functional/plugin/tutor_spec.lua +++ b/test/functional/plugin/tutor_spec.lua @@ -24,7 +24,6 @@ describe(':Tutor', function() [5] = { bold = true, foreground = Screen.colors.Magenta1 }, [6] = { italic = true }, }) - screen:attach() end) it('applies {unix:…,win:…} transform', function() diff --git a/test/functional/plugin/vim_syntax_spec.lua b/test/functional/plugin/vim_syntax_spec.lua index d99a69eab9..bdb4534cba 100644 --- a/test/functional/plugin/vim_syntax_spec.lua +++ b/test/functional/plugin/vim_syntax_spec.lua @@ -21,7 +21,6 @@ describe('Vimscript syntax highlighting', function() [1] = { foreground = Screen.colors.Brown, bold = true }, [2] = { foreground = tonumber('0x6a0dad') }, }) - screen:attach() end) it('prefixed boolean options are highlighted properly', function() |