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/api/ui_spec.lua | |
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/api/ui_spec.lua')
-rw-r--r-- | test/functional/api/ui_spec.lua | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/test/functional/api/ui_spec.lua b/test/functional/api/ui_spec.lua index 2145db7f8a..5976610af1 100644 --- a/test/functional/api/ui_spec.lua +++ b/test/functional/api/ui_spec.lua @@ -18,8 +18,7 @@ describe('nvim_ui_attach()', function() end) it('handles very large width/height #2180', function() - local screen = Screen.new(999, 999) - screen:attach() + local _ = Screen.new(999, 999) eq(999, eval('&lines')) eq(999, eval('&columns')) end) @@ -64,8 +63,7 @@ describe('nvim_ui_attach()', function() eq('UI not attached to channel: 1', pcall_err(request, 'nvim_ui_set_option', 'rgb', true)) eq('UI not attached to channel: 1', pcall_err(request, 'nvim_ui_detach')) - local screen = Screen.new() - screen:attach({ rgb = false }) + local _ = Screen.new(nil, nil, { rgb = false }) eq( 'UI already attached to channel: 1', pcall_err(request, 'nvim_ui_attach', 40, 10, { rgb = false }) @@ -82,7 +80,6 @@ it('autocmds UIEnter/UILeave', function() autocmd VimEnter * call add(g:evs, "VimEnter") ]]) local screen = Screen.new() - screen:attach() eq({ chan = 1 }, eval('g:uienter_ev')) screen:detach() eq({ chan = 1 }, eval('g:uileave_ev')) @@ -96,7 +93,6 @@ end) it('autocmds VimSuspend/VimResume #22041', function() clear() local screen = Screen.new() - screen:attach() exec([[ let g:ev = [] autocmd VimResume * :call add(g:ev, 'r') |