aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/api/proc_spec.lua12
-rw-r--r--test/functional/core/job_spec.lua52
-rw-r--r--test/functional/terminal/tui_spec.lua15
-rw-r--r--test/functional/ui/fold_spec.lua16
-rw-r--r--test/functional/ui/sign_spec.lua24
5 files changed, 114 insertions, 5 deletions
diff --git a/test/functional/api/proc_spec.lua b/test/functional/api/proc_spec.lua
index d99c26b6c2..e11e03203f 100644
--- a/test/functional/api/proc_spec.lua
+++ b/test/functional/api/proc_spec.lua
@@ -17,24 +17,28 @@ describe('api', function()
it('returns child process ids', function()
local this_pid = funcs.getpid()
+ -- Might be non-zero already (left-over from some other test?),
+ -- but this is not what is tested here.
+ local initial_childs = request('nvim_get_proc_children', this_pid)
+
local job1 = funcs.jobstart(nvim_argv)
retry(nil, nil, function()
- eq(1, #request('nvim_get_proc_children', this_pid))
+ eq(#initial_childs + 1, #request('nvim_get_proc_children', this_pid))
end)
local job2 = funcs.jobstart(nvim_argv)
retry(nil, nil, function()
- eq(2, #request('nvim_get_proc_children', this_pid))
+ eq(#initial_childs + 2, #request('nvim_get_proc_children', this_pid))
end)
funcs.jobstop(job1)
retry(nil, nil, function()
- eq(1, #request('nvim_get_proc_children', this_pid))
+ eq(#initial_childs + 1, #request('nvim_get_proc_children', this_pid))
end)
funcs.jobstop(job2)
retry(nil, nil, function()
- eq(0, #request('nvim_get_proc_children', this_pid))
+ eq(#initial_childs, #request('nvim_get_proc_children', this_pid))
end)
end)
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index eb02610df0..86466415e5 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -439,16 +439,66 @@ describe('jobs', function()
call add(self.data, Normalize(a:data))
sleep 200m
endfunction
+ function! d.on_exit(job, data, event) dict
+ let g:exit_data = copy(self.data)
+ endfunction
+ if has('win32')
+ let cmd = 'for /L %I in (1,1,5) do @(echo %I& ping -n 2 127.0.0.1 > nul)'
+ else
+ let cmd = ['sh', '-c', 'for i in $(seq 1 5); do echo $i; sleep 0.1; done']
+ endif
+ let g:id = jobstart(cmd, d)
+ sleep 1500m
+ call jobwait([g:id])
+ ]])
+
+ local expected = {'1', '2', '3', '4', '5', ''}
+ local chunks = eval('d.data')
+ -- check nothing was received after exit, including EOF
+ eq(eval('g:exit_data'), chunks)
+ local received = {''}
+ for i, chunk in ipairs(chunks) do
+ if i < #chunks then
+ -- if chunks got joined, a spurious [''] callback was not sent
+ neq({''}, chunk)
+ else
+ -- but EOF callback is still sent
+ eq({''}, chunk)
+ end
+ received[#received] = received[#received]..chunk[1]
+ for j = 2, #chunk do
+ received[#received+1] = chunk[j]
+ end
+ end
+ eq(expected, received)
+ end)
+
+ it('does not invoke callbacks recursively', function()
+ source([[
+ let d = {'data': []}
+ function! d.on_stdout(job, data, event) dict
+ " if callbacks were invoked recursively, this would cause on_stdout
+ " to be invoked recursively and the data reversed on the call stack
+ sleep 200m
+ call add(self.data, Normalize(a:data))
+ endfunction
+ function! d.on_exit(job, data, event) dict
+ let g:exit_data = copy(self.data)
+ endfunction
if has('win32')
let cmd = 'for /L %I in (1,1,5) do @(echo %I& ping -n 2 127.0.0.1 > nul)'
else
let cmd = ['sh', '-c', 'for i in $(seq 1 5); do echo $i; sleep 0.1; done']
endif
- call jobwait([jobstart(cmd, d)])
+ let g:id = jobstart(cmd, d)
+ sleep 1500m
+ call jobwait([g:id])
]])
local expected = {'1', '2', '3', '4', '5', ''}
local chunks = eval('d.data')
+ -- check nothing was received after exit, including EOF
+ eq(eval('g:exit_data'), chunks)
local received = {''}
for i, chunk in ipairs(chunks) do
if i < #chunks then
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index a8a49cd378..0522d59c9a 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -182,6 +182,21 @@ describe('TUI', function()
]])
end)
+ it('handles pasting a specific amount of text', function()
+ -- Need extra time for this test, specially in ASAN.
+ screen.timeout = 60000
+ feed_data('i\027[200~'..string.rep('z', 64)..'\027[201~')
+ screen:expect([[
+ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz|
+ zzzzzzzzzzzzzz{1: } |
+ {4:~ }|
+ {4:~ }|
+ {5:[No Name] [+] }|
+ {3:-- INSERT --} |
+ {3:-- TERMINAL --} |
+ ]])
+ end)
+
it('can handle arbitrarily long bursts of input', function()
-- Need extra time for this test, specially in ASAN.
screen.timeout = 60000
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua
index 5fa299bed9..c5ef718883 100644
--- a/test/functional/ui/fold_spec.lua
+++ b/test/functional/ui/fold_spec.lua
@@ -28,6 +28,22 @@ describe("folded lines", function()
screen:detach()
end)
+ it("work with more than one signcolumn", function()
+ command("set signcolumn=yes:9")
+ feed("i<cr><esc>")
+ feed("vkzf")
+ screen:expect([[
+ {5: ^+-- 2 lines: ·············}|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end)
+
it("highlighting with relative line numbers", function()
command("set relativenumber foldmethod=marker")
feed_command("set foldcolumn=2")
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua
index 2b38a2a58d..68e675b8e5 100644
--- a/test/functional/ui/sign_spec.lua
+++ b/test/functional/ui/sign_spec.lua
@@ -31,6 +31,30 @@ describe('Signs', function()
end)
describe(':sign place', function()
+ it('allows signs with combining characters', function()
+ feed('ia<cr>b<cr><esc>')
+ command('sign define piet1 text=𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄ texthl=Search')
+ command('sign define piet2 text=𠜎̀́̂̃̄̅ texthl=Search')
+ command('sign place 1 line=1 name=piet1 buffer=1')
+ command('sign place 2 line=2 name=piet2 buffer=1')
+ screen:expect([[
+ {1:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}a |
+ {1:𠜎̀́̂̃̄̅}b |
+ {2: }^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
+
it('shadows previously placed signs', function()
feed('ia<cr>b<cr>c<cr><esc>')
command('sign define piet text=>> texthl=Search')