API: validation: mention invalid method name (#8489)

This commit is contained in:
Justin M. Keyes
2018-06-07 10:56:44 +02:00
committed by GitHub
parent 5a82afa17a
commit 3abf17ae88
7 changed files with 37 additions and 11 deletions

View File

@@ -20,9 +20,20 @@ local format_string = global_helpers.format_string
local intchar2lua = global_helpers.intchar2lua
local mergedicts_copy = global_helpers.mergedicts_copy
describe('api', function()
describe('API', function()
before_each(clear)
it('validates requests', function()
expect_err('Invalid method: bogus',
request, 'bogus')
expect_err('Invalid method: … の り 。…',
request, '… の り 。…')
expect_err('Invalid method: <empty>',
request, '')
expect_err("can't serialize object",
request, nil)
end)
describe('nvim_command', function()
it('works', function()
local fname = helpers.tmpname()
@@ -924,7 +935,7 @@ describe('api', function()
{'i_am_not_a_method', {'xx'}},
{'nvim_set_var', {'avar', 10}},
}
eq({{}, {0, error_types.Exception.id, 'Invalid method name'}},
eq({{}, {0, error_types.Exception.id, 'Invalid method: i_am_not_a_method'}},
meths.call_atomic(req))
eq(5, meths.get_var('avar'))
end)