2016-07-14 21:11:49 -05:00
|
|
|
local session = require('test.functional.helpers')(after_each)
|
|
|
|
local child_session = require('test.functional.terminal.helpers')
|
|
|
|
|
2016-08-15 18:42:12 -05:00
|
|
|
if session.pending_win32(pending) then return end
|
|
|
|
|
2016-07-14 21:11:49 -05:00
|
|
|
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: } |
|
2016-08-09 10:01:56 -05:00
|
|
|
{4:~ }|
|
|
|
|
{4:~ }|
|
|
|
|
{4:~ }|
|
|
|
|
{5:[No Name] }|
|
2016-07-14 21:11:49 -05:00
|
|
|
|
|
2016-08-09 10:01:56 -05:00
|
|
|
{3:-- TERMINAL --} |
|
2016-07-14 21:11:49 -05:00
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
after_each(function()
|
2016-09-14 09:19:07 -05:00
|
|
|
child_session.feed_data("\3") -- Ctrl-C
|
2016-07-14 21:11:49 -05:00
|
|
|
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([[
|
2016-08-09 10:01:56 -05:00
|
|
|
{4:~ }|
|
|
|
|
{4:~ }|
|
|
|
|
{5:[No Name] }|
|
2016-09-14 19:59:09 -05:00
|
|
|
:!printf foo; sleep 200 |
|
2016-07-14 21:11:49 -05:00
|
|
|
|
|
2016-09-14 19:59:09 -05:00
|
|
|
foo |
|
2016-08-09 10:01:56 -05:00
|
|
|
{3:-- TERMINAL --} |
|
2016-07-14 21:11:49 -05:00
|
|
|
]])
|
|
|
|
end)
|
2016-09-29 19:33:50 -05:00
|
|
|
|
2016-10-07 06:18:24 -05:00
|
|
|
it("throttles shell-command output greater than ~10KB", function()
|
|
|
|
screen.timeout = 20000 -- Avoid false failure on slow systems.
|
2016-09-29 19:33:50 -05:00
|
|
|
child_session.feed_data(
|
2016-10-07 06:18:24 -05:00
|
|
|
":!for i in $(seq 2 3000); do echo XXXXXXXXXX $i; done\n")
|
|
|
|
|
|
|
|
-- If we observe any line starting with a dot, then throttling occurred.
|
2016-09-29 19:33:50 -05:00
|
|
|
screen:expect("\n.", nil, nil, nil, true)
|
2016-10-07 06:18:24 -05:00
|
|
|
|
|
|
|
-- Final chunk of output should always be displayed, never skipped.
|
|
|
|
-- (Throttling is non-deterministic, this test is merely a sanity check.)
|
|
|
|
screen:expect([[
|
|
|
|
XXXXXXXXXX 2996 |
|
|
|
|
XXXXXXXXXX 2997 |
|
|
|
|
XXXXXXXXXX 2998 |
|
|
|
|
XXXXXXXXXX 2999 |
|
|
|
|
XXXXXXXXXX 3000 |
|
|
|
|
{10:Press ENTER or type command to continue}{1: } |
|
|
|
|
{3:-- TERMINAL --} |
|
|
|
|
]])
|
2016-09-29 19:33:50 -05:00
|
|
|
end)
|
2016-07-14 21:11:49 -05:00
|
|
|
end)
|