aboutsummaryrefslogtreecommitdiff
path: root/test/functional/autocmd
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-11-11 22:15:19 +0100
committerbfredl <bjorn.linse@gmail.com>2024-11-14 12:40:57 +0100
commite61228a214ebda9845db9462dad0a8c362d3963f (patch)
treefc5908c85c0cc6affc3bc325cd75f6efaeea95d8 /test/functional/autocmd
parent40dee8a2dcba996badaa6182eb34fde1694f92a3 (diff)
downloadrneovim-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/autocmd')
-rw-r--r--test/functional/autocmd/autocmd_oldtest_spec.lua1
-rw-r--r--test/functional/autocmd/autocmd_spec.lua3
-rw-r--r--test/functional/autocmd/cmdline_spec.lua1
-rw-r--r--test/functional/autocmd/show_spec.lua1
-rw-r--r--test/functional/autocmd/win_scrolled_resized_spec.lua4
5 files changed, 1 insertions, 9 deletions
diff --git a/test/functional/autocmd/autocmd_oldtest_spec.lua b/test/functional/autocmd/autocmd_oldtest_spec.lua
index 5e4beb7684..7b40b0a25b 100644
--- a/test/functional/autocmd/autocmd_oldtest_spec.lua
+++ b/test/functional/autocmd/autocmd_oldtest_spec.lua
@@ -102,7 +102,6 @@ describe('oldtests', function()
-- oldtest: Test_delete_ml_get_errors()
it('no ml_get error with TextChanged autocommand and delete', function()
local screen = Screen.new(75, 10)
- screen:attach()
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.Cyan1 },
}
diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua
index 0429cfee89..c62e4752e0 100644
--- a/test/functional/autocmd/autocmd_spec.lua
+++ b/test/functional/autocmd/autocmd_spec.lua
@@ -258,7 +258,6 @@ describe('autocmd', function()
-- Check redrawing and API accesses to this window.
local screen = Screen.new(50, 10)
- screen:attach()
source([[
function! Doit()
@@ -333,7 +332,6 @@ describe('autocmd', function()
it('`aucmd_win` cannot be changed into a normal window #13699', function()
local screen = Screen.new(50, 10)
- screen:attach()
-- Create specific layout and ensure it's left unchanged.
-- Use vim._with on a hidden buffer so aucmd_win is used.
@@ -498,7 +496,6 @@ describe('autocmd', function()
it(':doautocmd does not warn "No matching autocommands" #10689', function()
local screen = Screen.new(32, 3)
- screen:attach()
feed(':doautocmd User Foo<cr>')
screen:expect {
diff --git a/test/functional/autocmd/cmdline_spec.lua b/test/functional/autocmd/cmdline_spec.lua
index ca137debb8..7e13c0f349 100644
--- a/test/functional/autocmd/cmdline_spec.lua
+++ b/test/functional/autocmd/cmdline_spec.lua
@@ -60,7 +60,6 @@ describe('cmdline autocommands', function()
it('handles errors correctly', function()
clear()
local screen = Screen.new(72, 8)
- screen:attach()
command("autocmd CmdlineEnter * echoerr 'FAIL'")
command("autocmd CmdlineLeave * echoerr 'very error'")
diff --git a/test/functional/autocmd/show_spec.lua b/test/functional/autocmd/show_spec.lua
index 10d242527f..fcac706349 100644
--- a/test/functional/autocmd/show_spec.lua
+++ b/test/functional/autocmd/show_spec.lua
@@ -46,7 +46,6 @@ describe(':autocmd', function()
screen:add_extra_attr_ids {
[100] = { foreground = Screen.colors.Magenta, bold = true },
}
- screen:attach()
exec([[
set more
autocmd! BufEnter
diff --git a/test/functional/autocmd/win_scrolled_resized_spec.lua b/test/functional/autocmd/win_scrolled_resized_spec.lua
index 72bbc1e469..23de83e3dc 100644
--- a/test/functional/autocmd/win_scrolled_resized_spec.lua
+++ b/test/functional/autocmd/win_scrolled_resized_spec.lua
@@ -225,8 +225,7 @@ end)
describe('WinScrolled', function()
-- oldtest: Test_WinScrolled_mouse()
it('is triggered by mouse scrolling in another window', function()
- local screen = Screen.new(75, 10)
- screen:attach()
+ local _ = Screen.new(75, 10)
exec([[
set nowrap scrolloff=0
set mouse=a
@@ -304,7 +303,6 @@ describe('WinScrolled', function()
it('is triggered by mouse scrolling in unfocused floating window #18222', function()
local screen = Screen.new(80, 24)
- screen:attach()
exec([[
let g:scrolled = 0