mirror of
https://github.com/neovim/neovim.git
synced 2026-04-19 22:10:45 +00:00
perf(vim.text): use lookup table implementation for hex encoding (#30080)
Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
@@ -26,5 +26,21 @@ describe('vim.text', function()
|
||||
eq(output, vim.text.hexencode(input))
|
||||
eq(input, vim.text.hexdecode(output))
|
||||
end)
|
||||
|
||||
it('errors on invalid input', function()
|
||||
-- Odd number of hex characters
|
||||
do
|
||||
local res, err = vim.text.hexdecode('ABC')
|
||||
eq(nil, res)
|
||||
eq('string must have an even number of hex characters', err)
|
||||
end
|
||||
|
||||
-- Non-hexadecimal input
|
||||
do
|
||||
local res, err = vim.text.hexdecode('nothex')
|
||||
eq(nil, res)
|
||||
eq('string must contain only hex characters', err)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user