diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-11-14 13:10:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-14 13:10:32 +0100 |
commit | 7d771c3eeef5b4dca9ebc5ed6f7ca03f2b26b6bc (patch) | |
tree | fc5908c85c0cc6affc3bc325cd75f6efaeea95d8 /test/functional/terminal | |
parent | 40dee8a2dcba996badaa6182eb34fde1694f92a3 (diff) | |
parent | e61228a214ebda9845db9462dad0a8c362d3963f (diff) | |
download | rneovim-7d771c3eeef5b4dca9ebc5ed6f7ca03f2b26b6bc.tar.gz rneovim-7d771c3eeef5b4dca9ebc5ed6f7ca03f2b26b6bc.tar.bz2 rneovim-7d771c3eeef5b4dca9ebc5ed6f7ca03f2b26b6bc.zip |
Merge pull request #31168 from bfredl/noattach
fix(tests): needing two calls to setup a screen is cringe
Diffstat (limited to 'test/functional/terminal')
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 3 | ||||
-rw-r--r-- | test/functional/terminal/channel_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/terminal/cursor_spec.lua | 3 | ||||
-rw-r--r-- | test/functional/terminal/edit_spec.lua | 10 | ||||
-rw-r--r-- | test/functional/terminal/ex_terminal_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/terminal/highlight_spec.lua | 12 | ||||
-rw-r--r-- | test/functional/terminal/scrollback_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/terminal/window_split_tab_spec.lua | 4 |
9 files changed, 9 insertions, 39 deletions
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 8ed6d03c6b..05258a9e50 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -411,7 +411,6 @@ describe(':terminal buffer', function() it('handles split UTF-8 sequences #16245', function() local screen = Screen.new(50, 7) - screen:attach() fn.termopen({ testprg('shell-test'), 'UTF-8' }) screen:expect([[ ^å | @@ -425,7 +424,6 @@ describe(':terminal buffer', function() it("handles bell respecting 'belloff' and 'visualbell'", function() local screen = Screen.new(50, 7) - screen:attach() local chan = api.nvim_open_term(0, {}) command('set belloff=') @@ -700,7 +698,6 @@ describe('termopen()', function() local function test_term_colorterm(expected, opts) local screen = Screen.new(50, 4) - screen:attach() fn.termopen({ nvim_prog, '-u', diff --git a/test/functional/terminal/channel_spec.lua b/test/functional/terminal/channel_spec.lua index 774ff01291..9912c1ff7b 100644 --- a/test/functional/terminal/channel_spec.lua +++ b/test/functional/terminal/channel_spec.lua @@ -21,7 +21,6 @@ describe('terminal channel is closed and later released if', function() before_each(function() clear() screen = Screen.new() - screen:attach() end) it('opened by nvim_open_term() and deleted by :bdelete!', function() @@ -122,7 +121,6 @@ end) it('chansend sends lines to terminal channel in proper order', function() clear({ args = { '--cmd', 'set laststatus=2' } }) local screen = Screen.new(100, 20) - screen:attach() screen._default_attr_ids = nil local shells = is_os('win') and { 'cmd.exe', 'pwsh.exe -nop', 'powershell.exe -nop' } or { 'sh' } for _, sh in ipairs(shells) do @@ -149,7 +147,6 @@ describe('no crash when TermOpen autocommand', function() screen:set_default_attr_ids({ [0] = { bold = true, foreground = Screen.colors.Blue }, }) - screen:attach() end) it('processes job exit event when using termopen()', function() @@ -231,7 +228,6 @@ describe('nvim_open_term', function() before_each(function() clear() screen = Screen.new(8, 10) - screen:attach() end) it('with force_crlf=true converts newlines', function() diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua index 0c5de45829..f223cdd417 100644 --- a/test/functional/terminal/cursor_spec.lua +++ b/test/functional/terminal/cursor_spec.lua @@ -122,13 +122,12 @@ describe('cursor with customized highlighting', function() clear() command('highlight TermCursor ctermfg=45 ctermbg=46 cterm=NONE') command('highlight TermCursorNC ctermfg=55 ctermbg=56 cterm=NONE') - screen = Screen.new(50, 7) + screen = Screen.new(50, 7, { rgb = false }) screen:set_default_attr_ids({ [1] = { foreground = 45, background = 46 }, [2] = { foreground = 55, background = 56 }, [3] = { bold = true }, }) - screen:attach({ rgb = false }) command('call termopen(["' .. testprg('tty-test') .. '"])') feed('i') poke_eventloop() diff --git a/test/functional/terminal/edit_spec.lua b/test/functional/terminal/edit_spec.lua index 24c5eb28e5..dcd566d04a 100644 --- a/test/functional/terminal/edit_spec.lua +++ b/test/functional/terminal/edit_spec.lua @@ -1,7 +1,7 @@ local t = require('test.testutil') local n = require('test.functional.testnvim')() -local screen = require('test.functional.ui.screen') +local Screen = require('test.functional.ui.screen') local testprg = n.testprg local command = n.command @@ -13,12 +13,6 @@ local matches = t.matches local pesc = vim.pesc describe(':edit term://*', function() - local get_screen = function(columns, lines) - local scr = screen.new(columns, lines) - scr:attach({ rgb = false }) - return scr - end - before_each(function() clear() api.nvim_set_option_value('shell', testprg('shell-test'), {}) @@ -37,7 +31,7 @@ describe(':edit term://*', function() it("runs TermOpen early enough to set buffer-local 'scrollback'", function() local columns, lines = 20, 4 - local scr = get_screen(columns, lines) + local scr = Screen.new(columns, lines, { rgb = false }) local rep = 97 api.nvim_set_option_value('shellcmdflag', 'REP ' .. rep, {}) command('set shellxquote=') -- win: avoid extra quotes diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index 1039572210..5ebe7bd4fc 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -21,8 +21,7 @@ describe(':terminal', function() before_each(function() clear() - screen = Screen.new(50, 4) - screen:attach({ rgb = false }) + screen = Screen.new(50, 4, { rgb = false }) screen._default_attr_ids = nil end) @@ -169,8 +168,7 @@ local function test_terminal_with_fake_shell(backslash) before_each(function() clear() - screen = Screen.new(50, 4) - screen:attach({ rgb = false }) + screen = Screen.new(50, 4, { rgb = false }) screen._default_attr_ids = nil api.nvim_set_option_value('shell', shell_path, {}) api.nvim_set_option_value('shellcmdflag', 'EXE', {}) diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua index 05d68f6754..7822a27b93 100644 --- a/test/functional/terminal/highlight_spec.lua +++ b/test/functional/terminal/highlight_spec.lua @@ -17,7 +17,7 @@ describe(':terminal highlight', function() before_each(function() clear() - screen = Screen.new(50, 7) + screen = Screen.new(50, 7, { rgb = false }) screen:set_default_attr_ids({ [1] = { foreground = 45 }, [2] = { background = 46 }, @@ -33,7 +33,6 @@ describe(':terminal highlight', function() [12] = { bold = true, underdouble = true }, [13] = { italic = true, undercurl = true }, }) - screen:attach({ rgb = false }) command(("enew | call termopen(['%s'])"):format(testprg('tty-test'))) feed('i') screen:expect([[ @@ -130,7 +129,7 @@ end) it(':terminal highlight has lower precedence than editor #9964', function() clear() - local screen = Screen.new(30, 4) + local screen = Screen.new(30, 4, { rgb = true }) screen:set_default_attr_ids({ -- "Normal" highlight emitted by the child nvim process. N_child = { @@ -150,7 +149,6 @@ it(':terminal highlight has lower precedence than editor #9964', function() bg_indexed = true, }, }) - screen:attach({ rgb = true }) -- Child nvim process in :terminal (with cterm colors). fn.termopen({ nvim_prog_abs(), @@ -202,7 +200,6 @@ it('CursorLine and CursorColumn work in :terminal buffer in Normal mode', functi [4] = { background = Screen.colors.Grey90, reverse = true }, [5] = { background = Screen.colors.Red }, }) - screen:attach() command(("enew | call termopen(['%s'])"):format(testprg('tty-test'))) screen:expect([[ ^tty ready | @@ -308,7 +305,6 @@ describe(':terminal highlight forwarding', function() [3] = { { fg_indexed = true, foreground = tonumber('0xe0e000') }, { foreground = 3 } }, [4] = { { foreground = tonumber('0xff8000') }, {} }, }) - screen:attach() command(("enew | call termopen(['%s'])"):format(testprg('tty-test'))) feed('i') screen:expect([[ @@ -343,7 +339,7 @@ describe(':terminal highlight with custom palette', function() before_each(function() clear() - screen = Screen.new(50, 7) + screen = Screen.new(50, 7, { rgb = true }) screen:set_default_attr_ids({ [1] = { foreground = tonumber('0x123456') }, -- no fg_indexed when overridden [2] = { foreground = 12 }, @@ -354,7 +350,6 @@ describe(':terminal highlight with custom palette', function() [8] = { background = 11 }, [9] = { bold = true }, }) - screen:attach({ rgb = true }) api.nvim_set_var('terminal_color_3', '#123456') command(("enew | call termopen(['%s'])"):format(testprg('tty-test'))) feed('i') @@ -389,7 +384,6 @@ describe(':terminal', function() screen:add_extra_attr_ids { [100] = { url = 'https://example.com' }, } - screen:attach() local chan = api.nvim_open_term(0, {}) api.nvim_chan_send(chan, '\027]8;;https://example.com\027\\Example\027]8;;\027\\') screen:expect({ diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua index da0bd97270..1751db1aa9 100644 --- a/test/functional/terminal/scrollback_spec.lua +++ b/test/functional/terminal/scrollback_spec.lua @@ -354,8 +354,7 @@ end) describe(':terminal prints more lines than the screen height and exits', function() it('will push extra lines to scrollback', function() clear() - local screen = Screen.new(30, 7) - screen:attach({ rgb = false }) + local screen = Screen.new(30, 7, { rgb = false }) command(("call termopen(['%s', '10']) | startinsert"):format(testprg('tty-test'))) screen:expect([[ line6 | @@ -580,7 +579,6 @@ describe('pending scrollback line handling', function() before_each(function() clear() screen = Screen.new(30, 7) - screen:attach() screen:set_default_attr_ids { [1] = { foreground = Screen.colors.Brown }, [2] = { reverse = true }, diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index d150231243..ded0cd99d3 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -2114,7 +2114,6 @@ describe('TUI', function() [5] = { bold = true, reverse = true }, [6] = { foreground = Screen.colors.White, background = Screen.colors.DarkGreen }, }) - screen:attach() fn.termopen({ nvim_prog, '--clean', @@ -2147,7 +2146,6 @@ describe('TUI', function() for _, guicolors in ipairs({ 'notermguicolors', 'termguicolors' }) do it('has no black flicker when clearing regions during startup with ' .. guicolors, function() local screen = Screen.new(50, 10) - screen:attach() fn.termopen({ nvim_prog, '--clean', diff --git a/test/functional/terminal/window_split_tab_spec.lua b/test/functional/terminal/window_split_tab_spec.lua index e9218e9a3b..272fc513af 100644 --- a/test/functional/terminal/window_split_tab_spec.lua +++ b/test/functional/terminal/window_split_tab_spec.lua @@ -30,10 +30,6 @@ describe(':terminal', function() command('highlight VertSplit NONE') end) - after_each(function() - screen:detach() - end) - it('next to a closing window', function() command('split') command('terminal') |