mirror of
https://github.com/neovim/neovim.git
synced 2026-05-24 05:40:08 +00:00
feat(eval): treat Lua string as "blob" in writefile() #39098
Problem: vim.fn.writefile() treats Lua strings as Vimscript strings instead of a "binary clean" string. Solution: Treat Lua-originated strings as blob data.
This commit is contained in:
@@ -6,6 +6,7 @@ local clear = n.clear
|
||||
local eq = t.eq
|
||||
local fn = n.fn
|
||||
local api = n.api
|
||||
local exec_lua = n.exec_lua
|
||||
local read_file = t.read_file
|
||||
local write_file = t.write_file
|
||||
local pcall_err = t.pcall_err
|
||||
@@ -99,6 +100,11 @@ describe('writefile()', function()
|
||||
eq('a\0', read_file(fname))
|
||||
end)
|
||||
|
||||
it('writes Lua strings to a file', function()
|
||||
eq(0, exec_lua([[return vim.fn.writefile('foo\0bar', ..., 'b')]], fname))
|
||||
eq('foo\0bar', read_file(fname))
|
||||
end)
|
||||
|
||||
it('shows correct file name when supplied numbers', function()
|
||||
api.nvim_set_current_dir(dname)
|
||||
eq(
|
||||
|
||||
Reference in New Issue
Block a user