diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:39:54 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:39:54 +0000 |
commit | 21cb7d04c387e4198ca8098a884c78b56ffcf4c2 (patch) | |
tree | 84fe5690df1551f0bb2bdfe1a13aacd29ebc1de7 /test/functional/ui/embed_spec.lua | |
parent | d9c904f85a23a496df4eb6be42aa43f007b22d50 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-colorcolchar.tar.gz rneovim-colorcolchar.tar.bz2 rneovim-colorcolchar.zip |
Merge remote-tracking branch 'upstream/master' into colorcolcharcolorcolchar
Diffstat (limited to 'test/functional/ui/embed_spec.lua')
-rw-r--r-- | test/functional/ui/embed_spec.lua | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua index cd2b48213d..9729f65355 100644 --- a/test/functional/ui/embed_spec.lua +++ b/test/functional/ui/embed_spec.lua @@ -5,7 +5,12 @@ local Screen = require('test.functional.ui.screen') local feed = helpers.feed local eq = helpers.eq +local neq = helpers.neq local clear = helpers.clear +local ok = helpers.ok +local funcs = helpers.funcs +local nvim_prog = helpers.nvim_prog +local retry = helpers.retry local function test_embed(ext_linegrid) local screen @@ -98,6 +103,7 @@ describe('--embed UI', function() -- attach immediately after startup, for early UI local screen = Screen.new(40, 8) + screen.rpc_async = true -- Avoid hanging. #24888 screen:attach {stdin_fd=3} screen:set_default_attr_ids { [1] = {bold = true, foreground = Screen.colors.Blue1}; @@ -132,3 +138,50 @@ describe('--embed UI', function() ]]} end) end) + +describe('--embed --listen UI', function() + it('waits for connection on listening address', function() + helpers.skip(helpers.is_os('win')) + clear() + local child_server = assert(helpers.new_pipename()) + funcs.jobstart({nvim_prog, '--embed', '--listen', child_server, '--clean'}) + retry(nil, nil, function() neq(nil, uv.fs_stat(child_server)) end) + + local child_session = helpers.connect(child_server) + + local info_ok, api_info = child_session:request('nvim_get_api_info') + ok(info_ok) + eq(2, #api_info) + ok(api_info[1] > 2, 'channel_id > 2', api_info[1]) + + child_session:request('nvim_exec2', [[ + let g:evs = [] + autocmd UIEnter * call add(g:evs, $"UIEnter:{v:event.chan}") + autocmd VimEnter * call add(g:evs, "VimEnter") + ]], {}) + + -- VimEnter and UIEnter shouldn't be triggered until after attach + local var_ok, var = child_session:request('nvim_get_var', 'evs') + ok(var_ok) + eq({}, var) + + local child_screen = Screen.new(40, 6) + child_screen:attach(nil, child_session) + child_screen:expect{grid=[[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {2:[No Name] 0,0-1 All}| + | + ]], attr_ids={ + [1] = {foreground = Screen.colors.Blue, bold = true}; + [2] = {reverse = true, bold = true}; + }} + + -- VimEnter and UIEnter should now be triggered + var_ok, var = child_session:request('nvim_get_var', 'evs') + ok(var_ok) + eq({'VimEnter', ('UIEnter:%d'):format(api_info[1])}, var) + end) +end) |