aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal/edit_spec.lua
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-07-16 21:35:53 +0200
committerGitHub <noreply@github.com>2019-07-16 21:35:53 +0200
commit3a1d3e9ef1d34e4e6d499aad0968c6f7daf0fd9d (patch)
treedb71172d76ce1d476b8cda110205fc6670b3c807 /test/functional/terminal/edit_spec.lua
parentbab24a88ab48e18506bb00c6418a76ef77f77f49 (diff)
downloadrneovim-3a1d3e9ef1d34e4e6d499aad0968c6f7daf0fd9d.tar.gz
rneovim-3a1d3e9ef1d34e4e6d499aad0968c6f7daf0fd9d.tar.bz2
rneovim-3a1d3e9ef1d34e4e6d499aad0968c6f7daf0fd9d.zip
tests: shell-test: use count for REP (#10514)
Also fix V576: use width specification > Incorrect format. Consider checking the third actual argument of the > 'sscanf' function. It's dangerous to use string specifier without width > specification. Buffer overflow is possible.
Diffstat (limited to 'test/functional/terminal/edit_spec.lua')
-rw-r--r--test/functional/terminal/edit_spec.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/test/functional/terminal/edit_spec.lua b/test/functional/terminal/edit_spec.lua
index 84d7ae6e9c..d213bae7b3 100644
--- a/test/functional/terminal/edit_spec.lua
+++ b/test/functional/terminal/edit_spec.lua
@@ -34,10 +34,9 @@ describe(':edit term://*', function()
it("runs TermOpen early enough to set buffer-local 'scrollback'", function()
local columns, lines = 20, 4
local scr = get_screen(columns, lines)
- local rep = 'a'
+ local rep = 97
meths.set_option('shellcmdflag', 'REP ' .. rep)
command('set shellxquote=') -- win: avoid extra quotes
- local rep_size = rep:byte() -- 'a' => 97
local sb = 10
command('autocmd TermOpen * :setlocal scrollback='..tostring(sb)
..'|call feedkeys("G", "n")')
@@ -45,8 +44,8 @@ describe(':edit term://*', function()
local bufcontents = {}
local winheight = curwinmeths.get_height()
- local buf_cont_start = rep_size - sb - winheight + 2
- for i = buf_cont_start,(rep_size - 1) do
+ local buf_cont_start = rep - sb - winheight + 2
+ for i = buf_cont_start,(rep - 1) do
bufcontents[#bufcontents + 1] = ('%d: foobar'):format(i)
end
bufcontents[#bufcontents + 1] = ''