mirror of
https://github.com/neovim/neovim.git
synced 2025-11-17 15:51:32 +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:
@@ -543,23 +543,19 @@ describe('nvim_create_user_command', function()
|
||||
end)
|
||||
|
||||
it('does not allow invalid command names', function()
|
||||
matches("Invalid command name %(must begin with an uppercase letter%): 'test'", pcall_err(exec_lua, [[
|
||||
eq("Invalid command name (must start with uppercase): 'test'", pcall_err(exec_lua, [[
|
||||
vim.api.nvim_create_user_command('test', 'echo "hi"', {})
|
||||
]]))
|
||||
|
||||
matches('Invalid command name', pcall_err(exec_lua, [[
|
||||
eq("Invalid command name: 't@'", pcall_err(exec_lua, [[
|
||||
vim.api.nvim_create_user_command('t@', 'echo "hi"', {})
|
||||
]]))
|
||||
|
||||
matches('Invalid command name', pcall_err(exec_lua, [[
|
||||
eq("Invalid command name: 'T@st'", pcall_err(exec_lua, [[
|
||||
vim.api.nvim_create_user_command('T@st', 'echo "hi"', {})
|
||||
]]))
|
||||
|
||||
matches('Invalid command name', pcall_err(exec_lua, [[
|
||||
eq("Invalid command name: 'Test!'", pcall_err(exec_lua, [[
|
||||
vim.api.nvim_create_user_command('Test!', 'echo "hi"', {})
|
||||
]]))
|
||||
|
||||
matches('Invalid command name', pcall_err(exec_lua, [[
|
||||
eq("Invalid command name: '💩'", pcall_err(exec_lua, [[
|
||||
vim.api.nvim_create_user_command('💩', 'echo "hi"', {})
|
||||
]]))
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user