mirror of
https://github.com/neovim/neovim.git
synced 2026-05-03 12:35:00 +00:00
refactor(api): handle option dicts properly
Do not copy a lot of lua strings (dict keys) to just strequal() them Just compare them directly to a dedicated hash function. feat(generators): HASHY McHASHFACE
This commit is contained in:
@@ -436,16 +436,16 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
|
||||
end)
|
||||
|
||||
it('error on invalid optnames', function()
|
||||
eq('Invalid key: silentt',
|
||||
eq("Invalid key: 'silentt'",
|
||||
pcall_err(meths.set_keymap, 'n', 'lhs', 'rhs', {silentt = true}))
|
||||
eq('Invalid key: sidd',
|
||||
eq("Invalid key: 'sidd'",
|
||||
pcall_err(meths.set_keymap, 'n', 'lhs', 'rhs', {sidd = false}))
|
||||
eq('Invalid key: nowaiT',
|
||||
eq("Invalid key: 'nowaiT'",
|
||||
pcall_err(meths.set_keymap, 'n', 'lhs', 'rhs', {nowaiT = false}))
|
||||
end)
|
||||
|
||||
it('error on <buffer> option key', function()
|
||||
eq('Invalid key: buffer',
|
||||
eq("Invalid key: 'buffer'",
|
||||
pcall_err(meths.set_keymap, 'n', 'lhs', 'rhs', {buffer = true}))
|
||||
end)
|
||||
|
||||
@@ -454,8 +454,8 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
|
||||
-- note: need '%' to escape hyphens, which have special meaning in lua
|
||||
it('throws an error when given non-boolean value for '..opt, function()
|
||||
local opts = {}
|
||||
opts[opt] = 2
|
||||
eq('Gave non-boolean value for an opt: '..opt,
|
||||
opts[opt] = 'fooo'
|
||||
eq(opt..' is not a boolean',
|
||||
pcall_err(meths.set_keymap, 'n', 'lhs', 'rhs', opts))
|
||||
end)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user