mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test: output_spec
Reference: https://github.com/neovim/neovim/issues/3772#issuecomment-162334005
This commit is contained in:
parent
ae9cb1fe07
commit
ed3b3aa9cd
@ -1,4 +1,3 @@
|
||||
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local clear, eq, eval, execute, feed, insert, neq, next_msg, nvim,
|
||||
nvim_dir, ok, source, write_file, mkdir, rmdir = helpers.clear,
|
||||
@ -120,7 +119,7 @@ describe('jobs', function()
|
||||
{0, {'a', '', 'c', '', '', '', 'b', '', ''}}}, next_msg())
|
||||
end)
|
||||
|
||||
it('can preserve nuls', function()
|
||||
it('can preserve NULs', function()
|
||||
nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
|
||||
nvim('command', 'call jobsend(j, ["\n123\n", "abc\\nxyz\n", ""])')
|
||||
eq({'notification', 'stdout', {0, {'\n123\n', 'abc\nxyz\n', ''}}},
|
||||
@ -144,7 +143,7 @@ describe('jobs', function()
|
||||
eq({'notification', 'exit', {0, 0}}, next_msg())
|
||||
end)
|
||||
|
||||
it("won't allow jobsend with a job that closed stdin", function()
|
||||
it("disallows jobsend on a job that closed stdin", function()
|
||||
nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
|
||||
nvim('command', 'call jobclose(j, "stdin")')
|
||||
eq(false, pcall(function()
|
||||
@ -152,12 +151,12 @@ describe('jobs', function()
|
||||
end))
|
||||
end)
|
||||
|
||||
it('will not allow jobsend/stop on a non-existent job', function()
|
||||
it('disallows jobsend/stop on a non-existent job', function()
|
||||
eq(false, pcall(eval, "jobsend(-1, 'lol')"))
|
||||
eq(false, pcall(eval, "jobstop(-1)"))
|
||||
end)
|
||||
|
||||
it('will not allow jobstop twice on the same job', function()
|
||||
it('disallows jobstop twice on the same job', function()
|
||||
nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
|
||||
neq(0, eval('j'))
|
||||
eq(true, pcall(eval, "jobstop(j)"))
|
||||
@ -244,7 +243,7 @@ describe('jobs', function()
|
||||
eq({'notification', 'exit', {45, 10}}, next_msg())
|
||||
end)
|
||||
|
||||
it('cant redefine callbacks being used by a job', function()
|
||||
it('cannot redefine callbacks being used by a job', function()
|
||||
local screen = Screen.new()
|
||||
screen:attach()
|
||||
local script = [[
|
||||
|
39
test/functional/ui/output_spec.lua
Normal file
39
test/functional/ui/output_spec.lua
Normal file
@ -0,0 +1,39 @@
|
||||
local session = require('test.functional.helpers')(after_each)
|
||||
local child_session = require('test.functional.terminal.helpers')
|
||||
|
||||
describe("shell command :!", function()
|
||||
local screen
|
||||
before_each(function()
|
||||
session.clear()
|
||||
screen = child_session.screen_setup(0, '["'..session.nvim_prog..
|
||||
'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile"]')
|
||||
screen:expect([[
|
||||
{1: } |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
[No Name] |
|
||||
|
|
||||
-- TERMINAL -- |
|
||||
]])
|
||||
end)
|
||||
|
||||
after_each(function()
|
||||
screen:detach()
|
||||
end)
|
||||
|
||||
it("displays output even without LF/EOF. #4646 #4569 #3772", function()
|
||||
-- NOTE: We use a child nvim (within a :term buffer)
|
||||
-- to avoid triggering a UI flush.
|
||||
child_session.feed_data(":!printf foo; sleep 200\n")
|
||||
screen:expect([[
|
||||
~ |
|
||||
~ |
|
||||
[No Name] |
|
||||
:!printf foo; sleep 200 |
|
||||
|
|
||||
foo |
|
||||
-- TERMINAL -- |
|
||||
]])
|
||||
end)
|
||||
end)
|
Loading…
Reference in New Issue
Block a user