feat(eval): writefile() treats RPC string as "blob"

related: fb6aeaba2d
This commit is contained in:
Justin M. Keyes
2026-07-11 13:37:53 +02:00
parent 0f7bd6a3cd
commit 8d51e07fa1
4 changed files with 23 additions and 10 deletions

View File

@@ -107,11 +107,18 @@ describe('writefile()', function()
eq('a\0', read_file(fname))
end)
it('writes Lua (binary) strings to a file', function()
it('writes Lua (binary) strings', function()
eq(0, exec_lua([[return vim.fn.writefile('foo\0bar', ..., 'b')]], fname))
eq('foo\0bar', read_file(fname))
end)
it('writes RPC-API (binary) String', function()
eq(0, api.nvim_call_function('writefile', { 'foobar', fname }))
eq('foobar', read_file(fname))
eq(0, api.nvim_call_function('writefile', { 'foo\0bar', fname }))
eq('foo\0bar', read_file(fname))
end)
it('shows correct file name when supplied numbers', function()
api.nvim_set_current_dir(dname)
eq(