feat: add vim.text module (#26069)

This commit is contained in:
Gregory Anders
2023-11-16 11:35:54 -06:00
committed by GitHub
parent b4b7ca2d54
commit 4bf47222c9
6 changed files with 84 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local eq = helpers.eq
describe('vim.text', function()
before_each(clear)
describe('hexencode() and hexdecode()', function()
it('works', function()
local cases = {
{ 'Hello world!', '48656C6C6F20776F726C6421' },
{ '😂', 'F09F9882' },
}
for _, v in ipairs(cases) do
local input, output = unpack(v)
eq(output, vim.text.hexencode(input))
eq(input, vim.text.hexdecode(output))
end
end)
end)
end)