aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal/edit_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2016-02-28 06:54:05 +0300
committerZyX <kp-pav@yandex.ru>2016-02-28 07:34:36 +0300
commit712f057ed91bd74039836628acd9543fd4d889f6 (patch)
tree0aa3c21821c9b9cf93ccf6279ce8a67398a08b10 /test/functional/terminal/edit_spec.lua
parentc6eeefa339ee3452866ed5517b6e8a3decc1ec67 (diff)
downloadrneovim-712f057ed91bd74039836628acd9543fd4d889f6.tar.gz
rneovim-712f057ed91bd74039836628acd9543fd4d889f6.tar.bz2
rneovim-712f057ed91bd74039836628acd9543fd4d889f6.zip
functests: Make sure that setting scrollback size works from TermOpen
Diffstat (limited to 'test/functional/terminal/edit_spec.lua')
-rw-r--r--test/functional/terminal/edit_spec.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/terminal/edit_spec.lua b/test/functional/terminal/edit_spec.lua
index 924f90e8f8..1062bb4843 100644
--- a/test/functional/terminal/edit_spec.lua
+++ b/test/functional/terminal/edit_spec.lua
@@ -1,5 +1,8 @@
local helpers = require('test.functional.helpers')
+local screen = require('test.functional.ui.screen')
+local curbufmeths = helpers.curbufmeths
+local curwinmeths = helpers.curwinmeths
local nvim_dir = helpers.nvim_dir
local command = helpers.command
local meths = helpers.meths
@@ -10,6 +13,7 @@ describe(':edit term://*', function()
before_each(function()
clear()
meths.set_option('shell', nvim_dir .. '/shell-test')
+ meths.set_option('shellcmdflag', 'EXE')
end)
it('runs TermOpen event', function()
@@ -20,4 +24,28 @@ describe(':edit term://*', function()
eq(1, #termopen_runs)
eq(termopen_runs[1], termopen_runs[1]:match('^term://.//%d+:$'))
end)
+
+ it('runs TermOpen early enough to respect terminal_scrollback_buffer_size', function()
+ local rep = 'a'
+ meths.set_option('shellcmdflag', 'REP ' .. rep)
+ local rep_size = rep:byte()
+ local sb = 10
+ local gsb = 20
+ meths.set_var('terminal_scrollback_buffer_size', gsb)
+ command('autocmd TermOpen * :let b:terminal_scrollback_buffer_size = '
+ .. tostring(sb))
+ command('edit term://foobar')
+ local bufcontents = {}
+ local winheight = curwinmeths.get_height()
+ -- I have no idea why there is + 4 needed. But otherwise it works fine with
+ -- different scrollbacks.
+ local shift = -4
+ for i = (rep_size - 1 - sb - winheight - shift),(rep_size - 1) do
+ bufcontents[#bufcontents + 1] = ('%d: foobar'):format(i)
+ end
+ bufcontents[#bufcontents + 1] = ''
+ bufcontents[#bufcontents + 1] = '[Process exited 0]'
+ command('sleep 500m')
+ eq(bufcontents, curbufmeths.get_line_slice(1, -1, true, true))
+ end)
end)