mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
refactor(api): consistent VALIDATE messages #22262
Problem: Validation messages are not consistently formatted. - Parameter names sometimes are NOT quoted. - Descriptive names (non-parameters) sometimes ARE quoted. Solution: Always quote the `name` value passed to a VALIDATE macro _unless_ the value has whitespace.
This commit is contained in:
@@ -45,11 +45,11 @@ describe('API', function()
|
||||
it('validation', function()
|
||||
local status, rv = pcall(request, "nvim_get_proc_children", -1)
|
||||
eq(false, status)
|
||||
eq("Invalid pid: -1", string.match(rv, "Invalid.*"))
|
||||
eq("Invalid 'pid': -1", string.match(rv, "Invalid.*"))
|
||||
|
||||
status, rv = pcall(request, "nvim_get_proc_children", 0)
|
||||
eq(false, status)
|
||||
eq("Invalid pid: 0", string.match(rv, "Invalid.*"))
|
||||
eq("Invalid 'pid': 0", string.match(rv, "Invalid.*"))
|
||||
|
||||
-- Assume PID 99999 does not exist.
|
||||
status, rv = pcall(request, "nvim_get_proc_children", 99999)
|
||||
@@ -71,11 +71,11 @@ describe('API', function()
|
||||
it('validation', function()
|
||||
local status, rv = pcall(request, "nvim_get_proc", -1)
|
||||
eq(false, status)
|
||||
eq("Invalid pid: -1", string.match(rv, "Invalid.*"))
|
||||
eq("Invalid 'pid': -1", string.match(rv, "Invalid.*"))
|
||||
|
||||
status, rv = pcall(request, "nvim_get_proc", 0)
|
||||
eq(false, status)
|
||||
eq("Invalid pid: 0", string.match(rv, "Invalid.*"))
|
||||
eq("Invalid 'pid': 0", string.match(rv, "Invalid.*"))
|
||||
|
||||
-- Assume PID 99999 does not exist.
|
||||
status, rv = pcall(request, "nvim_get_proc", 99999)
|
||||
|
||||
Reference in New Issue
Block a user