diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-10-07 13:18:24 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-12-10 01:26:34 +0100 |
commit | cb589990079a0e58bed3e1831f70baaba52f66fc (patch) | |
tree | 50a8b0ef7cc8167d75e6d35d5df64e099866adc6 /test | |
parent | 97204e1cef4f922cc1f8e67f8a1f2f695d7da826 (diff) | |
download | rneovim-cb589990079a0e58bed3e1831f70baaba52f66fc.tar.gz rneovim-cb589990079a0e58bed3e1831f70baaba52f66fc.tar.bz2 rneovim-cb589990079a0e58bed3e1831f70baaba52f66fc.zip |
os/shell: do_os_system(): Always show last chunk.
This ameliorates use-cases like:
:!cat foo.txt
:make
where the user is interested in the last few lines of output.
Try these shell-based ex-commands before/after this commit:
:grep -r '' *
:make
:!yes
:!grep -r '' *
:!git grep ''
:!cat foo
:!echo foo
:!while true; do date; done
:!for i in `seq 1 20000`; do echo XXXXXXXXXX $i; done
In all cases the last few lines of the command should always be shown,
regardless of where throttling was triggered.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/output_spec.lua | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua index 4aae2edfaa..d6d8f1c4e5 100644 --- a/test/functional/ui/output_spec.lua +++ b/test/functional/ui/output_spec.lua @@ -1,6 +1,5 @@ local session = require('test.functional.helpers')(after_each) local child_session = require('test.functional.terminal.helpers') -local Screen = require('test.functional.ui.screen') if session.pending_win32(pending) then return end @@ -41,10 +40,24 @@ describe("shell command :!", function() ]]) end) - it("throttles shell-command output greater than ~20KB", function() + it("throttles shell-command output greater than ~10KB", function() + screen.timeout = 20000 -- Avoid false failure on slow systems. child_session.feed_data( - ":!for i in $(seq 2 3000); do echo XXXXXXXXXX; done\n") - -- If a line with only a dot "." appears, then throttling was triggered. + ":!for i in $(seq 2 3000); do echo XXXXXXXXXX $i; done\n") + + -- If we observe any line starting with a dot, then throttling occurred. screen:expect("\n.", nil, nil, nil, true) + + -- 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 --} | + ]]) end) end) |