diff options
Diffstat (limited to 'test/functional/core/remote_spec.lua')
-rw-r--r-- | test/functional/core/remote_spec.lua | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/test/functional/core/remote_spec.lua b/test/functional/core/remote_spec.lua index a0ec748446..caff06f6ab 100644 --- a/test/functional/core/remote_spec.lua +++ b/test/functional/core/remote_spec.lua @@ -6,7 +6,7 @@ local eq = helpers.eq local exec_capture = helpers.exec_capture local exec_lua = helpers.exec_lua local expect = helpers.expect -local funcs = helpers.funcs +local fn = helpers.fn local insert = helpers.insert local nvim_prog = helpers.nvim_prog local new_argv = helpers.new_argv @@ -42,7 +42,7 @@ describe('Remote', function() -- Run a `nvim --remote*` command and return { stdout, stderr } of the process local function run_remote(...) set_session(server) - local addr = funcs.serverlist()[1] + local addr = fn.serverlist()[1] -- Create an nvim instance just to run the remote-invoking nvim. We want -- to wait for the remote instance to exit and calling jobwait blocks @@ -51,7 +51,10 @@ describe('Remote', function() local client_starter = spawn(new_argv(), false, nil, true) set_session(client_starter) -- Call jobstart() and jobwait() in the same RPC request to reduce flakiness. - eq({ 0 }, exec_lua([[return vim.fn.jobwait({ vim.fn.jobstart({...}, { + eq( + { 0 }, + exec_lua( + [[return vim.fn.jobwait({ vim.fn.jobstart({...}, { stdout_buffered = true, stderr_buffered = true, on_stdout = function(_, data, _) @@ -60,7 +63,15 @@ describe('Remote', function() on_stderr = function(_, data, _) _G.Remote_stderr = table.concat(data, '\n') end, - }) })]], nvim_prog, '--clean', '--headless', '--server', addr, ...)) + }) })]], + nvim_prog, + '--clean', + '--headless', + '--server', + addr, + ... + ) + ) local res = exec_lua([[return { _G.Remote_stdout, _G.Remote_stderr }]]) client_starter:close() set_session(server) @@ -70,20 +81,20 @@ describe('Remote', function() it('edit a single file', function() eq({ '', '' }, run_remote('--remote', fname)) expect(contents) - eq(2, #funcs.getbufinfo()) + eq(1, #fn.getbufinfo()) end) it('tab edit a single file with a non-changed buffer', function() eq({ '', '' }, run_remote('--remote-tab', fname)) expect(contents) - eq(1, #funcs.gettabinfo()) + eq(1, #fn.gettabinfo()) end) it('tab edit a single file with a changed buffer', function() insert('hello') eq({ '', '' }, run_remote('--remote-tab', fname)) expect(contents) - eq(2, #funcs.gettabinfo()) + eq(2, #fn.gettabinfo()) end) it('edit multiple files', function() @@ -91,15 +102,15 @@ describe('Remote', function() expect(contents) command('next') expect(other_contents) - eq(3, #funcs.getbufinfo()) + eq(2, #fn.getbufinfo()) end) it('send keys', function() - eq({ '', '' }, run_remote('--remote-send', ':edit '..fname..'<CR><C-W>v')) + eq({ '', '' }, run_remote('--remote-send', ':edit ' .. fname .. '<CR><C-W>v')) expect(contents) - eq(2, #funcs.getwininfo()) + eq(2, #fn.getwininfo()) -- Only a single buffer as we're using edit and not drop like --remote does - eq(1, #funcs.getbufinfo()) + eq(1, #fn.getbufinfo()) end) it('evaluate expressions', function() @@ -116,7 +127,7 @@ describe('Remote', function() it('creates server if not found', function() clear('--remote', fname) expect(contents) - eq(1, #funcs.getbufinfo()) + eq(1, #fn.getbufinfo()) -- Since we didn't pass silent, we should get a complaint neq(nil, string.find(exec_capture('messages'), 'E247:')) end) @@ -124,8 +135,8 @@ describe('Remote', function() it('creates server if not found with tabs', function() clear('--remote-tab-silent', fname, other_fname) expect(contents) - eq(2, #funcs.gettabinfo()) - eq(2, #funcs.getbufinfo()) + eq(2, #fn.gettabinfo()) + eq(2, #fn.getbufinfo()) -- We passed silent, so no message should be issued about the server not being found eq(nil, string.find(exec_capture('messages'), 'E247:')) end) |