~ubuntu-branches/debian/sid/neovim/sid

« back to all changes in this revision

Viewing changes to test/functional/viml/function_spec.lua

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2016-04-18 21:42:19 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20160418214219-1e6d4o1fwqarzk46
Tags: 0.1.3-1
* New upstream release.  (Closes: #820562)
* debian/control:
  + Remove unnecessary luarocks Build-Depends
  + Add libkvm-dev Build-Depends for kfreebsd-*
  + Add python(3)-neovim to Recommends.  (Closes: #812737)
  + Declare compiance with policy 3.9.8, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
local helpers = require('test.functional.helpers')
 
2
 
 
3
local clear = helpers.clear
 
4
local eq = helpers.eq
 
5
local exc_exec = helpers.exc_exec
 
6
 
 
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
 
10
 
 
11
  before_each(clear)
 
12
 
 
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)
 
20
  end)
 
21
 
 
22
  it('rpcnotify()', function()
 
23
    local rpcnotify = helpers.funcs.rpcnotify
 
24
    local ret = rpcnotify(0, 'foo', unpack(range(3, max_func_args)))
 
25
    eq(1, ret)
 
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)
 
28
  end)
 
29
end)