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/vimscript/has_spec.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test/functional/vimscript/has_spec.lua') diff --git a/test/functional/vimscript/has_spec.lua b/test/functional/vimscript/has_spec.lua index 1d2187be6b..ff90edfe30 100644 --- a/test/functional/vimscript/has_spec.lua +++ b/test/functional/vimscript/has_spec.lua @@ -4,6 +4,7 @@ local Screen = require('test.functional.ui.screen') local clear = n.clear local connect = n.connect +local get_session = n.get_session local eq = t.eq local fn = n.fn local is_os = t.is_os @@ -74,12 +75,12 @@ describe('has()', function() it('"gui_running"', function() eq(0, fn.has('gui_running')) - local tui = Screen.new(50, 15) + local tui_session = get_session() local gui_session = connect(fn.serverstart()) - local gui = Screen.new(50, 15) eq(0, fn.has('gui_running')) - tui:attach({ ext_linegrid = true, rgb = true, stdin_tty = true, stdout_tty = true }) - gui:attach({ ext_multigrid = true, rgb = true }, gui_session) + local tui = Screen.new(50, 5, { rgb = true, stdin_tty = true, stdout_tty = true }, tui_session) + eq(0, fn.has('gui_running')) + local gui = Screen.new(50, 15, { ext_multigrid = true, rgb = true }, gui_session) eq(1, fn.has('gui_running')) tui:detach() eq(1, fn.has('gui_running')) -- cgit