diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-09-23 11:00:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-23 11:00:20 +0800 |
commit | c26b39a9aa56e834262753e08372240fde9dcdf1 (patch) | |
tree | be46bd448633a3f51ea0505d5363466215a3c45a /test | |
parent | c68c121f50ee0eae7f26ed043689105086572f55 (diff) | |
download | rneovim-c26b39a9aa56e834262753e08372240fde9dcdf1.tar.gz rneovim-c26b39a9aa56e834262753e08372240fde9dcdf1.tar.bz2 rneovim-c26b39a9aa56e834262753e08372240fde9dcdf1.zip |
fix(tui): make :cquit work properly with remote TUI (#25313)
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 66 |
1 files changed, 59 insertions, 7 deletions
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 2d4613dda4..f8d2c01771 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -1720,7 +1720,15 @@ describe('TUI', function() it('no assert failure on deadly signal #21896', function() exec_lua([[vim.uv.kill(vim.fn.jobpid(vim.bo.channel), 'sigterm')]]) - screen:expect({any = '%[Process exited 1%]'}) + screen:expect{grid=[[ + Vim: Caught deadly signal 'SIGTERM' | + | + | + [Process exited 1]{1: } | + | + | + {3:-- TERMINAL --} | + ]]} end) it('no stack-use-after-scope with cursor color #22432', function() @@ -2743,7 +2751,15 @@ describe("TUI as a client", function() -- No heap-use-after-free when receiving UI events after deadly signal #22184 server:request('nvim_input', ('a'):rep(1000)) exec_lua([[vim.uv.kill(vim.fn.jobpid(vim.bo.channel), 'sigterm')]]) - screen:expect({any = '%[Process exited 1%]'}) + screen:expect{grid=[[ + Vim: Caught deadly signal 'SIGTERM' | + | + | + [Process exited 1]{1: } | + | + | + {3:-- TERMINAL --} | + ]]} eq(0, meths.get_vvar('shell_error')) -- exits on input eof #22244 @@ -2771,7 +2787,7 @@ describe("TUI as a client", function() ]]) end) - it("exits when server quits", function() + local function test_remote_tui_quit(status) local server_super = spawn_argv(false) -- equivalent to clear() local client_super = spawn_argv(true) @@ -2780,6 +2796,15 @@ describe("TUI as a client", function() local screen_server = thelpers.screen_setup(0, string.format([=[["%s", "--listen", "%s", "-u", "NONE", "-i", "NONE", "--cmd", "%s laststatus=2 background=dark"]]=], nvim_prog, server_pipe, nvim_set)) + screen_server:expect{grid=[[ + {1: } | + {4:~ }| + {4:~ }| + {4:~ }| + {5:[No Name] }| + | + {3:-- TERMINAL --} | + ]]} feed_data("iHello, World") screen_server:expect{grid=[[ @@ -2819,13 +2844,40 @@ describe("TUI as a client", function() -- quitting the server set_session(server_super) - feed_data(":q!\n") - screen_server:expect({any="Process exited 0"}) - + feed_data(status and ':' .. status .. 'cquit!\n' or ":quit!\n") + status = status and status or 0 + screen_server:expect{grid=[[ + | + [Process exited ]] .. status .. [[]{1: }{MATCH:%s+}| + | + | + | + | + {3:-- TERMINAL --} | + ]]} -- assert that client has exited - screen_client:expect({any="Process exited 0"}) + screen_client:expect{grid=[[ + | + [Process exited ]] .. status .. [[]{1: }{MATCH:%s+}| + | + | + | + | + {3:-- TERMINAL --} | + ]]} + server_super:close() client_super:close() + end + + describe("exits when server quits", function() + it("with :quit", function() + test_remote_tui_quit() + end) + + it("with :cquit", function() + test_remote_tui_quit(42) + end) end) end) |