test_function_arg_count.vader
1 Before: 2 function! Func0() 3 endfunction 4 function! Func1(x) 5 endfunction 6 function! Func2(x,y) 7 endfunction 8 function! Func3(x,y,z) 9 endfunction 10 function! Func3a(x,y,z,...) 11 endfunction 12 13 After: 14 delfunction Func0 15 delfunction Func1 16 delfunction Func2 17 delfunction Func3 18 delfunction Func3a 19 20 Execute(We should be able to compute the argument count for function names): 21 AssertEqual 0, ale#util#FunctionArgCount('Func0') 22 AssertEqual 1, ale#util#FunctionArgCount('Func1') 23 AssertEqual 2, ale#util#FunctionArgCount('Func2') 24 AssertEqual 3, ale#util#FunctionArgCount('Func3') 25 AssertEqual 3, ale#util#FunctionArgCount('Func3a') 26 27 Execute(We should be able to compute the argument count for Funcrefs): 28 AssertEqual 0, ale#util#FunctionArgCount(function('Func0')) 29 AssertEqual 1, ale#util#FunctionArgCount(function('Func1')) 30 AssertEqual 2, ale#util#FunctionArgCount(function('Func2')) 31 AssertEqual 3, ale#util#FunctionArgCount(function('Func3')) 32 AssertEqual 3, ale#util#FunctionArgCount(function('Func3a')) 33 34 Execute(We should be able to compute the argument count for lambdas): 35 if has('lambda') 36 AssertEqual 0, ale#util#FunctionArgCount({->1}) 37 AssertEqual 1, ale#util#FunctionArgCount({x->1}) 38 AssertEqual 2, ale#util#FunctionArgCount({x,y->1}) 39 AssertEqual 3, ale#util#FunctionArgCount({x,y,z->1}) 40 AssertEqual 3, ale#util#FunctionArgCount({x,y,z,...->1}) 41 endif 42 43 Execute(We should be able to compute the argument count autoload functions not yet loaded): 44 AssertEqual 1, ale#util#FunctionArgCount(function('ale#fixers#yapf#Fix')) 45 AssertEqual 1, ale#util#FunctionArgCount('ale#fixers#yapf#Fix')