From e61228a214ebda9845db9462dad0a8c362d3963f Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 11 Nov 2024 22:15:19 +0100 Subject: 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. --- test/functional/api/extmark_spec.lua | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'test/functional/api/extmark_spec.lua') diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua index 52d8fd5097..f8d6fca74c 100644 --- a/test/functional/api/extmark_spec.lua +++ b/test/functional/api/extmark_spec.lua @@ -455,7 +455,6 @@ describe('API/extmarks', function() it('join works when no marks are present', function() screen = Screen.new(15, 10) - screen:attach() feed('a1') feed('kJ') -- This shouldn't seg fault @@ -508,7 +507,6 @@ describe('API/extmarks', function() it('marks move with char inserts', function() -- insertchar in edit.c (the ins_str branch) screen = Screen.new(15, 10) - screen:attach() set_extmark(ns, marks[1], 0, 3) feed('0') insert('abc') @@ -1726,7 +1724,6 @@ describe('API/extmarks', function() it('invalidated marks are deleted', function() screen = Screen.new(40, 6) - screen:attach() feed('dd6iaaa bbb cccgg') api.nvim_set_option_value('signcolumn', 'auto:2', {}) set_extmark(ns, 1, 0, 0, { invalidate = true, sign_text = 'S1', end_row = 1 }) @@ -1811,7 +1808,6 @@ describe('API/extmarks', function() it('respects priority', function() screen = Screen.new(15, 10) - screen:attach() set_extmark(ns, marks[1], 0, 0, { hl_group = 'Comment', @@ -1983,7 +1979,6 @@ describe('API/win_extmark', function() it('sends and only sends ui-watched marks to ui', function() screen = Screen.new(20, 4) - screen:attach() -- should send this set_extmark(ns, marks[1], 1, 0, { ui_watched = true }) -- should not send this @@ -2006,7 +2001,6 @@ describe('API/win_extmark', function() it('sends multiple ui-watched marks to ui', function() screen = Screen.new(20, 4) - screen:attach() feed('15A!') -- should send all of these set_extmark(ns, marks[1], 1, 0, { ui_watched = true, virt_text_pos = 'overlay' }) @@ -2052,7 +2046,6 @@ describe('API/win_extmark', function() it('updates ui-watched marks', function() screen = Screen.new(20, 4) - screen:attach() -- should send this set_extmark(ns, marks[1], 1, 0, { ui_watched = true }) -- should not send this @@ -2096,8 +2089,7 @@ describe('API/win_extmark', function() end) it('sends ui-watched to splits', function() - screen = Screen.new(20, 8) - screen:attach({ ext_multigrid = true }) + screen = Screen.new(20, 8, { ext_multigrid = true }) -- should send this set_extmark(ns, marks[1], 1, 0, { ui_watched = true }) -- should not send this -- cgit