1
local helpers = require('test.functional.helpers')
3
local clear = helpers.clear
5
local exc_exec = helpers.exc_exec
7
describe('Up to MAX_FUNC_ARGS arguments are handled by', function()
8
local max_func_args = 20 -- from eval.h
9
local range = helpers.funcs.range
13
it('printf()', function()
14
local printf = helpers.funcs.printf
15
local rep = helpers.funcs['repeat']
16
local expected = '2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,'
17
eq(expected, printf(rep('%d,', max_func_args-1), unpack(range(2, max_func_args))))
18
local ret = exc_exec('call printf("", 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)')
19
eq('Vim(call):E740: Too many arguments for function printf', ret)
22
it('rpcnotify()', function()
23
local rpcnotify = helpers.funcs.rpcnotify
24
local ret = rpcnotify(0, 'foo', unpack(range(3, max_func_args)))
26
ret = exc_exec('call rpcnotify(0, "foo", 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)')
27
eq('Vim(call):E740: Too many arguments for function rpcnotify', ret)