mirror of
https://github.com/neovim/neovim.git
synced 2025-09-09 04:48:18 +00:00
api: Add tests for when not to handle NULs.
This commit is contained in:
@@ -36,6 +36,10 @@ describe('vim_* functions', function()
|
|||||||
-- 19 * 2 (each japanese character occupies two cells)
|
-- 19 * 2 (each japanese character occupies two cells)
|
||||||
eq(44, nvim('strwidth', 'neovimのデザインかなりまともなのになってる。'))
|
eq(44, nvim('strwidth', 'neovimのデザインかなりまともなのになってる。'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('cannot handle NULs', function()
|
||||||
|
eq(0, nvim('strwidth', '\0abc'))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('{get,set}_current_line', function()
|
describe('{get,set}_current_line', function()
|
||||||
@@ -52,6 +56,11 @@ describe('vim_* functions', function()
|
|||||||
eq({1, 2, {['3'] = 1}}, nvim('get_var', 'lua'))
|
eq({1, 2, {['3'] = 1}}, nvim('get_var', 'lua'))
|
||||||
eq({1, 2, {['3'] = 1}}, nvim('eval', 'g:lua'))
|
eq({1, 2, {['3'] = 1}}, nvim('eval', 'g:lua'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('truncates values with NULs in them', function()
|
||||||
|
nvim('set_var', 'xxx', 'ab\0cd')
|
||||||
|
eq('ab', nvim('get_var', 'xxx'))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('{get,set}_option', function()
|
describe('{get,set}_option', function()
|
||||||
|
Reference in New Issue
Block a user