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:
Björn Linse
2021-08-21 13:55:12 +02:00
parent 9337fff8aa
commit 32565922ef
22 changed files with 729 additions and 536 deletions

View File

@@ -1514,7 +1514,7 @@ describe('float window', function()
it('API has proper error messages', function()
local buf = meths.create_buf(false,false)
eq("Invalid key 'bork'",
eq("Invalid key: 'bork'",
pcall_err(meths.open_win,buf, false, {width=20,height=2,bork=true}))
eq("'win' key is only valid with relative='win'",
pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,win=0}))
@@ -1527,13 +1527,15 @@ describe('float window', function()
eq("'relative' requires 'row'/'col' or 'bufpos'",
pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='editor'}))
eq("'width' key must be a positive Integer",
pcall_err(meths.open_win,buf, false, {width=-1,height=2,relative='editor'}))
pcall_err(meths.open_win,buf, false, {width=-1,height=2,relative='editor', row=0, col=0}))
eq("'height' key must be a positive Integer",
pcall_err(meths.open_win,buf, false, {width=20,height=-1,relative='editor'}))
pcall_err(meths.open_win,buf, false, {width=20,height=-1,relative='editor', row=0, col=0}))
eq("'height' key must be a positive Integer",
pcall_err(meths.open_win,buf, false, {width=20,height=0,relative='editor'}))
eq("Must specify 'width' and 'height'",
pcall_err(meths.open_win,buf, false, {relative='editor'}))
pcall_err(meths.open_win,buf, false, {width=20,height=0,relative='editor', row=0, col=0}))
eq("Must specify 'width'",
pcall_err(meths.open_win,buf, false, {relative='editor', row=0, col=0}))
eq("Must specify 'height'",
pcall_err(meths.open_win,buf, false, {relative='editor', row=0, col=0, width=2}))
end)
it('can be placed relative window or cursor', function()