summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional
diff options
context:
space:
mode:
authorBarrett Ruth <62671086+barrettruth@users.noreply.github.com>2026-04-22 13:36:43 -0400
committerGitHub <noreply@github.com>2026-04-22 13:36:43 -0400
commitfb6aeaba2d3a38c7febd0a39cabd89685de11b9d (patch)
tree438f983b11642e476800f422651de39040db007d /test/functional
parent496374e9513a5cbd0fd37fbd95d07d6306fa432d (diff)
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.
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/vimscript/writefile_spec.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/functional/vimscript/writefile_spec.lua b/test/functional/vimscript/writefile_spec.lua
index b81cb43691..f406e5a469 100644
--- a/test/functional/vimscript/writefile_spec.lua
+++ b/test/functional/vimscript/writefile_spec.lua
@@ -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(